aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2015-11-11 20:15:49 +0000
committerTobias Grosser <tobias@grosser.es>2015-11-11 20:15:49 +0000
commit910cf26811f83c784a5cf50e97ef8c19691334e4 (patch)
tree3a18fa67aea10c2338a52e1eb2b28914c4b1028e
parent5be2233a813de179225b6fd37adfcac0ca382898 (diff)
downloadllvm-910cf26811f83c784a5cf50e97ef8c19691334e4.zip
llvm-910cf26811f83c784a5cf50e97ef8c19691334e4.tar.gz
llvm-910cf26811f83c784a5cf50e97ef8c19691334e4.tar.bz2
ScopInfo: Do not try to model the memory accesses in an error block
Error blocks may contain arbitrary instructions, among them some which we can not modeled correctly. As we do not generate ScopStmts for error blocks anyhow there is no point in trying to generate access functions for them. This fixes llvm.org/PR25494 llvm-svn: 252794
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp6
-rw-r--r--polly/test/ScopInfo/do-not-model-error-block-accesses.ll33
2 files changed, 39 insertions, 0 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index 6831658..39ac622 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -3651,6 +3651,12 @@ void ScopInfo::buildStmts(Region &SR) {
void ScopInfo::buildAccessFunctions(Region &R, BasicBlock &BB,
Region *NonAffineSubRegion,
bool IsExitBlock) {
+ // We do not build access functions for error blocks, as they may contain
+ // instructions we can not model.
+ DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
+ if (isErrorBlock(BB, R, *LI, DT) && !IsExitBlock)
+ return;
+
Loop *L = LI->getLoopFor(&BB);
// The set of loops contained in non-affine subregions that are part of R.
diff --git a/polly/test/ScopInfo/do-not-model-error-block-accesses.ll b/polly/test/ScopInfo/do-not-model-error-block-accesses.ll
new file mode 100644
index 0000000..a161afc
--- /dev/null
+++ b/polly/test/ScopInfo/do-not-model-error-block-accesses.ll
@@ -0,0 +1,33 @@
+; RUN: opt %loadPolly -polly-scops -analyze < %s
+
+; Check that we do not crash on this input. Earlier this indeed crashed as
+; we tried to model the access functions in an error block.
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+; Function Attrs: nounwind uwtable
+define void @FORMAT3_4() #0 {
+entry:
+ br label %entry.split
+
+entry.split: ; preds = %entry
+ br i1 false, label %if.end.38, label %if.else
+
+if.else: ; preds = %entry.split
+ call void (i32, i32, i32*, ...) bitcast (void (...)* @BYTES_TO_BITS to void (i32, i32, i32*, ...)*)(i32 undef, i32 1, i32* undef) #2
+ %0 = load i32, i32* null, align 4
+ br label %if.end.38
+
+if.end.38: ; preds = %if.else, %entry.split
+ unreachable
+}
+
+declare void @BYTES_TO_BITS(...) #1
+
+attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="haswell" "target-features"="+aes,+avx,+avx2,+bmi,+bmi2,+cmov,+cx16,+f16c,+fma,+fsgsbase,+fxsr,+hle,+lzcnt,+mmx,+movbe,+pclmul,+popcnt,+rdrnd,+rtm,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+xsave,+xsaveopt,-adx,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512pf,-avx512vl,-fma4,-prfchw,-rdseed,-sha,-sse4a,-tbm,-xop,-xsavec,-xsaves" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="haswell" "target-features"="+aes,+avx,+avx2,+bmi,+bmi2,+cmov,+cx16,+f16c,+fma,+fsgsbase,+fxsr,+hle,+lzcnt,+mmx,+movbe,+pclmul,+popcnt,+rdrnd,+rtm,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+xsave,+xsaveopt,-adx,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512pf,-avx512vl,-fma4,-prfchw,-rdseed,-sha,-sse4a,-tbm,-xop,-xsavec,-xsaves" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #2 = { nounwind }
+
+!llvm.ident = !{!0}
+
+!0 = !{!"clang version 3.8.0 (http://llvm.org/git/clang.git 65eeefc97d2eee4d075ec7d9ed56b5f0786b6421)"}