summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp5
-rw-r--r--polly/test/ScopInfo/opaque-struct.ll25
2 files changed, 30 insertions, 0 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index 23b82c55dfa..48eb01d60c9 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -3992,6 +3992,11 @@ bool ScopInfo::buildAccessMultiDimFixed(
auto *Src = BitCast->getOperand(0);
auto *SrcTy = Src->getType();
auto *DstTy = BitCast->getType();
+ // Do not try to delinearize non-sized (opaque) pointers.
+ if ((SrcTy->isPointerTy() && !SrcTy->getPointerElementType()->isSized()) ||
+ (DstTy->isPointerTy() && !DstTy->getPointerElementType()->isSized())) {
+ return false;
+ }
if (SrcTy->isPointerTy() && DstTy->isPointerTy() &&
DL->getTypeAllocSize(SrcTy->getPointerElementType()) ==
DL->getTypeAllocSize(DstTy->getPointerElementType()))
diff --git a/polly/test/ScopInfo/opaque-struct.ll b/polly/test/ScopInfo/opaque-struct.ll
new file mode 100644
index 00000000000..2d6a66f5785
--- /dev/null
+++ b/polly/test/ScopInfo/opaque-struct.ll
@@ -0,0 +1,25 @@
+; RUN: opt %loadPolly -polly-scops -disable-output < %s
+;
+; Check that we do not crash with unsized (opaque) types.
+;
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+%struct.s3 = type opaque
+%struct.stmt = type opaque
+
+; Function Attrs: nounwind uwtable
+define void @columnMem(%struct.stmt* %pStmt) #0 {
+entry:
+ br label %if.else
+
+if.else: ; preds = %entry
+ %db = bitcast %struct.stmt* %pStmt to %struct.s3**
+ %0 = load %struct.s3*, %struct.s3** %db, align 8
+ br i1 false, label %if.end9, label %if.then7
+
+if.then7: ; preds = %if.else
+ br label %if.end9
+
+if.end9: ; preds = %if.then7, %if.else
+ ret void
+}
OpenPOWER on IntegriCloud