summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2014-01-29 23:08:10 +0000
committerTobias Grosser <tobias@grosser.es>2014-01-29 23:08:10 +0000
commit933edd04af0b0d2926832e601e982aacda155e2e (patch)
tree06a3e0cff8413c0b4292de64232ee3b2628b6ccf
parent1a97215050709055a7eaada96098362f213737e4 (diff)
downloadbcm5719-llvm-933edd04af0b0d2926832e601e982aacda155e2e.tar.gz
bcm5719-llvm-933edd04af0b0d2926832e601e982aacda155e2e.zip
IndependentBlocks: Do not assert for PHI nodes outside of scops
There does not seem to be a reason that we can not support PHI nodes outside of the scop that reference values within the SCoP. Or at least, the attached test case seems to do the right thing. We remove the assert for now. llvm-svn: 200427
-rw-r--r--polly/lib/IndependentBlocks.cpp1
-rw-r--r--polly/test/IndependentBlocks/phi_outside_scop.ll36
2 files changed, 36 insertions, 1 deletions
diff --git a/polly/lib/IndependentBlocks.cpp b/polly/lib/IndependentBlocks.cpp
index 44455ddb50c..fdf28baee33 100644
--- a/polly/lib/IndependentBlocks.cpp
+++ b/polly/lib/IndependentBlocks.cpp
@@ -419,7 +419,6 @@ bool IndependentBlocks::translateScalarToArray(Instruction *Inst,
while (!LoadOutside.empty()) {
Instruction *U = LoadOutside.pop_back_val();
- assert(!isa<PHINode>(U) && "Can not handle PHI node outside!");
SE->forgetValue(U);
U->replaceUsesOfWith(Inst, ExitLoad);
}
diff --git a/polly/test/IndependentBlocks/phi_outside_scop.ll b/polly/test/IndependentBlocks/phi_outside_scop.ll
new file mode 100644
index 00000000000..2172fabd80d
--- /dev/null
+++ b/polly/test/IndependentBlocks/phi_outside_scop.ll
@@ -0,0 +1,36 @@
+; RUN: opt %loadPolly -basicaa -polly-independent -S < %s | FileCheck %s
+; RUN: opt %loadPolly -basicaa -polly-independent -polly-codegen-scev -S < %s | FileCheck %s
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @phi_nodes_outside() {
+entry:
+ br label %for.i.1
+
+for.i.1:
+ %i.1 = phi i32 [ %i.1.next, %for.i.1 ], [ 0, %entry ]
+ %i.1.next = add nsw i32 %i.1, 1
+ br i1 false, label %for.i.1 , label %for.i.2.preheader
+
+for.i.2.preheader:
+ br label %for.i.2
+
+for.i.2:
+; The value of %i.1.next is used outside of the scop in a PHI node.
+ %i.2 = phi i32 [ %i.2.next , %for.i.2 ], [ %i.1.next, %for.i.2.preheader ]
+ %i.2.next = add nsw i32 %i.2, 1
+ fence seq_cst
+ br i1 false, label %for.i.2, label %cleanup
+
+cleanup:
+ ret void
+}
+
+; CHECK: store i32 %i.1.next, i32* %i.1.next.s2a
+
+; CHECK: for.i.2.preheader:
+; CHECK: %i.1.next.loadoutside = load i32* %i.1.next.s2a
+
+; CHECK: for.i.2:
+; CHECK: %i.2 = phi i32 [ %i.2.next, %for.i.2 ], [ %i.1.next.loadoutside, %for.i.2.preheader ]
+
OpenPOWER on IntegriCloud