[polly] 2eac8ce - Get the address space within getVectorPtrTy
Christopher Tetreault via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 20 14:42:27 PDT 2020
Author: Christopher Tetreault
Date: 2020-10-20T14:42:10-07:00
New Revision: 2eac8ce820e6c9fe51bf93b55cb8a781b8b9fc7c
URL: https://github.com/llvm/llvm-project/commit/2eac8ce820e6c9fe51bf93b55cb8a781b8b9fc7c
DIFF: https://github.com/llvm/llvm-project/commit/2eac8ce820e6c9fe51bf93b55cb8a781b8b9fc7c.diff
LOG: Get the address space within getVectorPtrTy
getVectorPtrTy is private to VectorBlockGenerator, and all uses query
the address space from the passed-in pointer prior to calling it.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D89745
Added:
Modified:
polly/include/polly/CodeGen/BlockGenerators.h
polly/lib/CodeGen/BlockGenerators.cpp
Removed:
################################################################################
diff --git a/polly/include/polly/CodeGen/BlockGenerators.h b/polly/include/polly/CodeGen/BlockGenerators.h
index dbdbbae40e56..f2c52c8fedcf 100644
--- a/polly/include/polly/CodeGen/BlockGenerators.h
+++ b/polly/include/polly/CodeGen/BlockGenerators.h
@@ -662,7 +662,7 @@ class VectorBlockGenerator : BlockGenerator {
Value *getVectorValue(ScopStmt &Stmt, Value *Old, ValueMapT &VectorMap,
VectorValueMapT &ScalarMaps, Loop *L);
- Type *getVectorPtrTy(const Value *V, int Width, unsigned AddrSpace);
+ Type *getVectorPtrTy(const Value *V, int Width);
/// Load a vector from a set of adjacent scalars
///
diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp
index b50a66d70e16..bb7c99822592 100644
--- a/polly/lib/CodeGen/BlockGenerators.cpp
+++ b/polly/lib/CodeGen/BlockGenerators.cpp
@@ -1037,10 +1037,9 @@ Value *VectorBlockGenerator::getVectorValue(ScopStmt &Stmt, Value *Old,
return Vector;
}
-Type *VectorBlockGenerator::getVectorPtrTy(const Value *Val, int Width,
- unsigned AddrSpace) {
- PointerType *PointerTy = dyn_cast<PointerType>(Val->getType());
- assert(PointerTy && "PointerType expected");
+Type *VectorBlockGenerator::getVectorPtrTy(const Value *Val, int Width) {
+ auto *PointerTy = cast<PointerType>(Val->getType());
+ unsigned AddrSpace = PointerTy->getAddressSpace();
Type *ScalarType = PointerTy->getElementType();
auto *FVTy = FixedVectorType::get(ScalarType, Width);
@@ -1053,8 +1052,7 @@ Value *VectorBlockGenerator::generateStrideOneLoad(
__isl_keep isl_id_to_ast_expr *NewAccesses, bool NegativeStride = false) {
unsigned VectorWidth = getVectorWidth();
auto *Pointer = Load->getPointerOperand();
- auto AS = Pointer->getType()->getPointerAddressSpace();
- Type *VectorPtrType = getVectorPtrTy(Pointer, VectorWidth, AS);
+ Type *VectorPtrType = getVectorPtrTy(Pointer, VectorWidth);
unsigned Offset = NegativeStride ? VectorWidth - 1 : 0;
Value *NewPointer = generateLocationAccessed(Stmt, Load, ScalarMaps[Offset],
@@ -1083,8 +1081,7 @@ Value *VectorBlockGenerator::generateStrideZeroLoad(
ScopStmt &Stmt, LoadInst *Load, ValueMapT &BBMap,
__isl_keep isl_id_to_ast_expr *NewAccesses) {
auto *Pointer = Load->getPointerOperand();
- auto AS = Pointer->getType()->getPointerAddressSpace();
- Type *VectorPtrType = getVectorPtrTy(Pointer, 1, AS);
+ Type *VectorPtrType = getVectorPtrTy(Pointer, 1);
Value *NewPointer =
generateLocationAccessed(Stmt, Load, BBMap, VLTS[0], NewAccesses);
Value *VectorPtr = Builder.CreateBitCast(NewPointer, VectorPtrType,
@@ -1204,8 +1201,7 @@ void VectorBlockGenerator::copyStore(
extractScalarValues(Store, VectorMap, ScalarMaps);
if (Access.isStrideOne(isl::manage_copy(Schedule))) {
- auto AS = Pointer->getType()->getPointerAddressSpace();
- Type *VectorPtrType = getVectorPtrTy(Pointer, getVectorWidth(), AS);
+ Type *VectorPtrType = getVectorPtrTy(Pointer, getVectorWidth());
Value *NewPointer = generateLocationAccessed(Stmt, Store, ScalarMaps[0],
VLTS[0], NewAccesses);
@@ -1343,8 +1339,7 @@ void VectorBlockGenerator::generateScalarVectorLoads(
continue;
auto *Address = getOrCreateAlloca(*MA);
- auto AS = Address->getType()->getPointerAddressSpace();
- Type *VectorPtrType = getVectorPtrTy(Address, 1, AS);
+ Type *VectorPtrType = getVectorPtrTy(Address, 1);
Value *VectorPtr = Builder.CreateBitCast(Address, VectorPtrType,
Address->getName() + "_p_vec_p");
auto *Val = Builder.CreateLoad(VectorPtr, Address->getName() + ".reload");
More information about the llvm-commits
mailing list