summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--polly/include/polly/ScopInfo.h6
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp15
-rw-r--r--polly/test/ScopInfo/pointer-used-as-base-pointer-and-scalar-read.ll16
-rw-r--r--polly/test/ScopInfo/same-base-address-scalar-and-array.ll4
4 files changed, 23 insertions, 18 deletions
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h
index 32e7f5f5a82..9f372388f7f 100644
--- a/polly/include/polly/ScopInfo.h
+++ b/polly/include/polly/ScopInfo.h
@@ -115,10 +115,11 @@ public:
/// @param IslCtx The isl context used to create the base pointer id.
/// @param DimensionSizes A vector containing the size of each dimension.
/// @param Kind The kind of the array object.
+ /// @param DL The data layout of the module.
/// @param S The scop this array object belongs to.
ScopArrayInfo(Value *BasePtr, Type *ElementType, isl_ctx *IslCtx,
ArrayRef<const SCEV *> DimensionSizes, enum ARRAYKIND Kind,
- Scop *S);
+ const DataLayout &DL, Scop *S);
/// @brief Update the sizes of the ScopArrayInfo object.
///
@@ -246,6 +247,9 @@ private:
/// We distinguish between SCALAR, PHI and ARRAY objects.
enum ARRAYKIND Kind;
+ /// @brief The data layout of the module.
+ const DataLayout &DL;
+
/// @brief The scop this SAI object belongs to.
Scop &S;
};
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index 83f797feb7c..43e14bdc0b0 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -164,8 +164,8 @@ static const ScopArrayInfo *identifyBasePtrOriginSAI(Scop *S, Value *BasePtr) {
ScopArrayInfo::ScopArrayInfo(Value *BasePtr, Type *ElementType, isl_ctx *Ctx,
ArrayRef<const SCEV *> Sizes, enum ARRAYKIND Kind,
- Scop *S)
- : BasePtr(BasePtr), ElementType(ElementType), Kind(Kind), S(*S) {
+ const DataLayout &DL, Scop *S)
+ : BasePtr(BasePtr), ElementType(ElementType), Kind(Kind), DL(DL), S(*S) {
std::string BasePtrName =
getIslCompatibleName("MemRef_", BasePtr, Kind == KIND_PHI ? "__phi" : "");
Id = isl_id_alloc(Ctx, BasePtrName.c_str(), this);
@@ -216,7 +216,7 @@ ScopArrayInfo::~ScopArrayInfo() {
std::string ScopArrayInfo::getName() const { return isl_id_get_name(Id); }
int ScopArrayInfo::getElemSizeInBytes() const {
- return ElementType->getPrimitiveSizeInBits() / 8;
+ return DL.getTypeAllocSize(ElementType);
}
isl_id *ScopArrayInfo::getBasePtrId() const { return isl_id_copy(Id); }
@@ -2863,8 +2863,9 @@ Scop::getOrCreateScopArrayInfo(Value *BasePtr, Type *AccessType,
ScopArrayInfo::ARRAYKIND Kind) {
auto &SAI = ScopArrayInfoMap[std::make_pair(BasePtr, Kind)];
if (!SAI) {
- SAI.reset(
- new ScopArrayInfo(BasePtr, AccessType, getIslCtx(), Sizes, Kind, this));
+ auto &DL = getRegion().getEntry()->getModule()->getDataLayout();
+ SAI.reset(new ScopArrayInfo(BasePtr, AccessType, getIslCtx(), Sizes, Kind,
+ DL, this));
} else {
// In case of mismatching array sizes, we bail out by setting the run-time
// context to false.
@@ -3573,13 +3574,13 @@ void ScopInfo::buildMemoryAccess(
if (LoadInst *Load = dyn_cast<LoadInst>(Inst)) {
SizeType = Load->getType();
- Size = TD->getTypeStoreSize(SizeType);
+ Size = TD->getTypeAllocSize(SizeType);
Type = MemoryAccess::READ;
Val = Load;
} else {
StoreInst *Store = cast<StoreInst>(Inst);
SizeType = Store->getValueOperand()->getType();
- Size = TD->getTypeStoreSize(SizeType);
+ Size = TD->getTypeAllocSize(SizeType);
Type = MemoryAccess::MUST_WRITE;
Val = Store->getValueOperand();
}
diff --git a/polly/test/ScopInfo/pointer-used-as-base-pointer-and-scalar-read.ll b/polly/test/ScopInfo/pointer-used-as-base-pointer-and-scalar-read.ll
index 8977bc4cc86..a89cd2340b8 100644
--- a/polly/test/ScopInfo/pointer-used-as-base-pointer-and-scalar-read.ll
+++ b/polly/test/ScopInfo/pointer-used-as-base-pointer-and-scalar-read.ll
@@ -6,17 +6,17 @@
; CHECK: Arrays {
; CHECK: float MemRef_A[*]; // Element size 4
-; CHECK: float* MemRef_A; // Element size 0
-; CHECK: float* MemRef_x__phi; // Element size 0
-; CHECK: float* MemRef_B; // Element size 0
-; CHECK: float* MemRef_C[*]; // Element size 0
+; CHECK: float* MemRef_A; // Element size 8
+; CHECK: float* MemRef_x__phi; // Element size 8
+; CHECK: float* MemRef_B; // Element size 8
+; CHECK: float* MemRef_C[*]; // Element size 8
; CHECK: }
; CHECK: Arrays (Bounds as pw_affs) {
; CHECK: float MemRef_A[*]; // Element size 4
-; CHECK: float* MemRef_A; // Element size 0
-; CHECK: float* MemRef_x__phi; // Element size 0
-; CHECK: float* MemRef_B; // Element size 0
-; CHECK: float* MemRef_C[*]; // Element size 0
+; CHECK: float* MemRef_A; // Element size 8
+; CHECK: float* MemRef_x__phi; // Element size 8
+; CHECK: float* MemRef_B; // Element size 8
+; CHECK: float* MemRef_C[*]; // Element size 8
; CHECK: }
; CHECK: Alias Groups (0):
; CHECK: n/a
diff --git a/polly/test/ScopInfo/same-base-address-scalar-and-array.ll b/polly/test/ScopInfo/same-base-address-scalar-and-array.ll
index 47a2e93acdf..494e0ce5553 100644
--- a/polly/test/ScopInfo/same-base-address-scalar-and-array.ll
+++ b/polly/test/ScopInfo/same-base-address-scalar-and-array.ll
@@ -4,8 +4,8 @@
; as it is used as a memory base pointer (%0) but also as a scalar (%out.addr.0.lcssa).
;
; CHECK: Arrays {
-; CHECK-NEXT: float* MemRef_out; // Element size 0
-; CHECK-NEXT: float* MemRef_out_addr_0_lcssa; // Element size 0
+; CHECK-NEXT: float* MemRef_out; // Element size 8
+; CHECK-NEXT: float* MemRef_out_addr_0_lcssa; // Element size 8
; CHECK-NEXT: float MemRef_out[*]; // Element size 4
; CHECK-NEXT: }
;
OpenPOWER on IntegriCloud