forked from OSchip/llvm-project
scop detection: remove an iteration over all uses
llvm-svn: 183799
This commit is contained in:
parent
b88ea5e991
commit
15117271c7
|
@ -141,7 +141,6 @@ BADSCOP_STAT(IndVar, "Non canonical induction variable in loop");
|
|||
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(Instruction &Inst,
|
|||
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(Instruction &Inst,
|
|||
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))
|
||||
|
|
Loading…
Reference in New Issue