[polly] r252794 - ScopInfo: Do not try to model the memory accesses in an error block

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 11 12:15:49 PST 2015


Author: grosser
Date: Wed Nov 11 14:15:49 2015
New Revision: 252794

URL: http://llvm.org/viewvc/llvm-project?rev=252794&view=rev
Log:
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

Added:
    polly/trunk/test/ScopInfo/do-not-model-error-block-accesses.ll
Modified:
    polly/trunk/lib/Analysis/ScopInfo.cpp

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=252794&r1=252793&r2=252794&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Wed Nov 11 14:15:49 2015
@@ -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.

Added: polly/trunk/test/ScopInfo/do-not-model-error-block-accesses.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/do-not-model-error-block-accesses.ll?rev=252794&view=auto
==============================================================================
--- polly/trunk/test/ScopInfo/do-not-model-error-block-accesses.ll (added)
+++ polly/trunk/test/ScopInfo/do-not-model-error-block-accesses.ll Wed Nov 11 14:15:49 2015
@@ -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)"}




More information about the llvm-commits mailing list