[polly] r251198 - BlockGenerator: Do not assert when finding model PHI nodes defined outside the scop

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 24 12:01:10 PDT 2015


Author: grosser
Date: Sat Oct 24 14:01:09 2015
New Revision: 251198

URL: http://llvm.org/viewvc/llvm-project?rev=251198&view=rev
Log:
BlockGenerator: Do not assert when finding model PHI nodes defined outside the scop

Such PHI nodes can not only appear in the ExitBlock of the Scop, but indeed
any scalar PHI node above the scop and used in the scop is modeled as scalar
read access.

Added:
    polly/trunk/test/Isl/CodeGen/phi-defined-before-scop.ll
Modified:
    polly/trunk/lib/CodeGen/BlockGenerators.cpp

Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=251198&r1=251197&r2=251198&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Sat Oct 24 14:01:09 2015
@@ -615,11 +615,8 @@ void BlockGenerator::createExitPHINodeMe
     if (!PHI)
       continue;
 
-    if (PHI->getParent() != AfterMergeBB) {
-      assert(R.contains(PHI) &&
-             "Modeled PHI nodes are expected to be in the region");
+    if (PHI->getParent() != AfterMergeBB)
       continue;
-    }
 
     std::string Name = PHI->getName();
     Value *ScalarAddr = getOrCreateScalarAlloca(PHI);

Added: polly/trunk/test/Isl/CodeGen/phi-defined-before-scop.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/phi-defined-before-scop.ll?rev=251198&view=auto
==============================================================================
--- polly/trunk/test/Isl/CodeGen/phi-defined-before-scop.ll (added)
+++ polly/trunk/test/Isl/CodeGen/phi-defined-before-scop.ll Sat Oct 24 14:01:09 2015
@@ -0,0 +1,53 @@
+; RUN: opt %loadPolly -polly-codegen < %s | FileCheck %s
+
+; CHECK-LABEL: polly.merge_new_and_old:
+; CHECK-NEXT: %tmp7.ph.merge = phi %struct.wibble* [ %tmp7.ph.final_reload, %polly.stmt.bb5 ], [ %tmp7.ph, %bb6.region_exiting ]
+
+; CHECK-LABEL: polly.stmt.bb3:
+; CHECK-NEXT: %tmp2.s2a.reload = load %struct.wibble*, %struct.wibble** %tmp2.s2a
+; CHECK-NEXT: store %struct.wibble* %tmp2, %struct.wibble** %tmp7.s2a
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+%struct.blam = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
+%struct.wibble = type { i32, %struct.wibble*, %struct.wibble* }
+
+ at global = external global %struct.blam*, align 8
+
+; Function Attrs: nounwind uwtable
+define void @wobble() #0 {
+bb:
+  br label %bb1
+
+bb1:                                              ; preds = %bb6, %bb
+  %tmp2 = phi %struct.wibble* [ %tmp7, %bb6 ], [ undef, %bb ]
+  %tmp = load %struct.blam*, %struct.blam** @global, align 8, !tbaa !1
+  br label %bb3
+
+bb3:                                              ; preds = %bb1
+  %tmp4 = getelementptr inbounds %struct.blam, %struct.blam* %tmp, i64 0, i32 1
+  br i1 false, label %bb6, label %bb5
+
+bb5:                                              ; preds = %bb3
+  br label %bb6
+
+bb6:                                              ; preds = %bb5, %bb3
+  %tmp7 = phi %struct.wibble* [ %tmp2, %bb3 ], [ undef, %bb5 ]
+  br i1 undef, label %bb8, label %bb1
+
+bb8:                                              ; preds = %bb6
+  br label %bb9
+
+bb9:                                              ; preds = %bb8
+  unreachable
+}
+
+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"="x86-64" "target-features"="+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
+
+!llvm.ident = !{!0}
+
+!0 = !{!"clang version 3.8.0 (trunk 250010) (llvm/trunk 250018)"}
+!1 = !{!2, !2, i64 0}
+!2 = !{!"any pointer", !3, i64 0}
+!3 = !{!"omnipotent char", !4, i64 0}
+!4 = !{!"Simple C/C++ TBAA"}




More information about the llvm-commits mailing list