[polly] r183799 - scop detection: remove an iteration over all uses

Sebastian Pop spop at codeaurora.org
Tue Jun 11 15:20:35 PDT 2013


Author: spop
Date: Tue Jun 11 17:20:35 2013
New Revision: 183799

URL: http://llvm.org/viewvc/llvm-project?rev=183799&view=rev
Log:
scop detection: remove an iteration over all uses

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=183799&r1=183798&r2=183799&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Tue Jun 11 17:20:35 2013
@@ -141,7 +141,6 @@ BADSCOP_STAT(IndVar, "Non canonical indu
 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");
@@ -326,30 +325,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))
@@ -361,10 +336,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))





More information about the llvm-commits mailing list