mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 01:07:04 +08:00
Perform memory accesses in the same addrspace as the corresponding memref.
It's not necessarily the case on all architectures that all memory is addressable in addrspace 0, so casting the pointer to addrspace 0 is liable to cause problems. Reviewed By: aartbik, ftynse, nicolasvasilache Differential Revision: https://reviews.llvm.org/D96380
This commit is contained in:
committed by
Aart Bik
parent
97ec8fa5bb
commit
08c681f645
@@ -209,15 +209,12 @@ static LogicalResult getIndexedPtrs(ConversionPatternRewriter &rewriter,
|
||||
return success();
|
||||
}
|
||||
|
||||
// Casts a strided element pointer to a vector pointer. The vector pointer
|
||||
// would always be on address space 0, therefore addrspacecast shall be
|
||||
// used when source/dst memrefs are not on address space 0.
|
||||
// Casts a strided element pointer to a vector pointer. The vector pointer
|
||||
// will be in the same address space as the incoming memref type.
|
||||
static Value castDataPtr(ConversionPatternRewriter &rewriter, Location loc,
|
||||
Value ptr, MemRefType memRefType, Type vt) {
|
||||
auto pType = LLVM::LLVMPointerType::get(vt);
|
||||
if (memRefType.getMemorySpace() == 0)
|
||||
return rewriter.create<LLVM::BitcastOp>(loc, pType, ptr);
|
||||
return rewriter.create<LLVM::AddrSpaceCastOp>(loc, pType, ptr);
|
||||
auto pType = LLVM::LLVMPointerType::get(vt, memRefType.getMemorySpace());
|
||||
return rewriter.create<LLVM::BitcastOp>(loc, pType, ptr);
|
||||
}
|
||||
|
||||
static LogicalResult
|
||||
|
||||
Reference in New Issue
Block a user