[polly] r200427 - IndependentBlocks: Do not assert for PHI nodes outside of scops
Tobias Grosser
tobias at grosser.es
Wed Jan 29 15:08:10 PST 2014
Author: grosser
Date: Wed Jan 29 17:08:10 2014
New Revision: 200427
URL: http://llvm.org/viewvc/llvm-project?rev=200427&view=rev
Log:
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.
Added:
polly/trunk/test/IndependentBlocks/phi_outside_scop.ll
Modified:
polly/trunk/lib/IndependentBlocks.cpp
Modified: polly/trunk/lib/IndependentBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/IndependentBlocks.cpp?rev=200427&r1=200426&r2=200427&view=diff
==============================================================================
--- polly/trunk/lib/IndependentBlocks.cpp (original)
+++ polly/trunk/lib/IndependentBlocks.cpp Wed Jan 29 17:08:10 2014
@@ -419,7 +419,6 @@ bool IndependentBlocks::translateScalarT
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);
}
Added: polly/trunk/test/IndependentBlocks/phi_outside_scop.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/IndependentBlocks/phi_outside_scop.ll?rev=200427&view=auto
==============================================================================
--- polly/trunk/test/IndependentBlocks/phi_outside_scop.ll (added)
+++ polly/trunk/test/IndependentBlocks/phi_outside_scop.ll Wed Jan 29 17:08:10 2014
@@ -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 ]
+
More information about the llvm-commits
mailing list