[polly] r185720 - scop detection: remove an iteration over all uses
Sebastian Pop
spop at codeaurora.org
Fri Jul 5 13:24:48 PDT 2013
Author: spop
Date: Fri Jul 5 15:24:47 2013
New Revision: 185720
URL: http://llvm.org/viewvc/llvm-project?rev=185720&view=rev
Log:
scop detection: remove an iteration over all uses
reenabled reverted patch after checking that it passes without regressions on
the nightly test-suite. Added testcase from Tobi.
Added:
polly/trunk/test/ScopDetect/dependency_to_phi_node_outside_of_region.ll
Modified:
polly/trunk/lib/Analysis/ScopDetection.cpp
Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=185720&r1=185719&r2=185720&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Fri Jul 5 15:24:47 2013
@@ -142,7 +142,6 @@ BADSCOP_STAT(IndEdge, "Found invalid reg
BADSCOP_STAT(LoopBound, "Loop bounds can not be computed");
BADSCOP_STAT(FuncCall, "Function call with side effects appeared");
BADSCOP_STAT(AffFunc, "Expression not affine");
-BADSCOP_STAT(Scalar, "Found scalar dependency");
BADSCOP_STAT(Alias, "Found base address alias");
BADSCOP_STAT(SimpleLoop, "Loop not in -loop-simplify form");
BADSCOP_STAT(Other, "Others");
@@ -329,30 +328,6 @@ bool ScopDetection::isValidMemoryAccess(
return true;
}
-bool ScopDetection::hasScalarDependency(Instruction &Inst,
- Region &RefRegion) const {
- for (Instruction::use_iterator UI = Inst.use_begin(), UE = Inst.use_end();
- UI != UE; ++UI)
- if (Instruction *Use = dyn_cast<Instruction>(*UI))
- if (!RefRegion.contains(Use->getParent())) {
- // DirtyHack 1: PHINode user outside the Scop is not allow, if this
- // PHINode is induction variable, the scalar to array transform may
- // break it and introduce a non-indvar PHINode, which is not allow in
- // Scop.
- // This can be fix by:
- // Introduce a IndependentBlockPrepare pass, which translate all
- // PHINodes not in Scop to array.
- // The IndependentBlockPrepare pass can also split the entry block of
- // the function to hold the alloca instruction created by scalar to
- // array. and split the exit block of the Scop so the new create load
- // instruction for escape users will not break other Scops.
- if (isa<PHINode>(Use))
- return true;
- }
-
- return false;
-}
-
bool ScopDetection::isValidInstruction(Instruction &Inst,
DetectionContext &Context) const {
if (PHINode *PN = dyn_cast<PHINode>(&Inst))
@@ -364,10 +339,6 @@ bool ScopDetection::isValidInstruction(I
INVALID(IndVar, "Non canonical PHI node: " << Inst);
}
- // Scalar dependencies are not allowed.
- if (hasScalarDependency(Inst, Context.CurRegion))
- INVALID(Scalar, "Scalar dependency found: " << Inst);
-
// We only check the call instruction but not invoke instruction.
if (CallInst *CI = dyn_cast<CallInst>(&Inst)) {
if (isValidCallInst(*CI))
Added: polly/trunk/test/ScopDetect/dependency_to_phi_node_outside_of_region.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopDetect/dependency_to_phi_node_outside_of_region.ll?rev=185720&view=auto
==============================================================================
--- polly/trunk/test/ScopDetect/dependency_to_phi_node_outside_of_region.ll (added)
+++ polly/trunk/test/ScopDetect/dependency_to_phi_node_outside_of_region.ll Fri Jul 5 15:24:47 2013
@@ -0,0 +1,34 @@
+; RUN: opt %loadPolly -polly-detect < %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"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @f(i64* %A, i64 %N, i64 %M) nounwind {
+entry:
+ fence seq_cst
+ br label %for.i
+
+for.i:
+ %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %for.i ]
+ %scevgep = getelementptr i64* %A, i64 %indvar
+ store i64 %indvar, i64* %scevgep
+ %indvar.next = add nsw i64 %indvar, 1
+ %exitcond = icmp eq i64 %indvar.next, %N
+ br i1 %exitcond, label %next, label %for.i
+
+next:
+ fence seq_cst
+ br label %for.j
+
+for.j:
+ %indvar.j = phi i64 [ %indvar, %next ], [ %indvar.j.next, %for.j ]
+ %scevgep.j = getelementptr i64* %A, i64 %indvar.j
+ store i64 %indvar.j, i64* %scevgep.j
+ fence seq_cst
+ %indvar.j.next = add nsw i64 %indvar.j, 1
+ %exitcond.j = icmp eq i64 %indvar.j.next, %M
+ br i1 %exitcond.j, label %return, label %for.j
+
+return:
+ fence seq_cst
+ ret void
+}
More information about the llvm-commits
mailing list