[FIX] Do not crash on opaque (unsized) types.

llvm-svn: 265834
This commit is contained in:
Johannes Doerfert 2016-04-08 19:20:03 +00:00
parent adcebdf2d1
commit 41725a1e7a
2 changed files with 30 additions and 0 deletions

View File

@ -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()))

View File

@ -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
}