[polly] scop detection: could we stop iterating over uses?
Sebastian Pop
spop at codeaurora.org
Mon Jun 3 09:22:25 PDT 2013
Hi,
I see that we call hasScalarDependency over every instruction in a region, and
that iterates over all the uses of the instruction. Here is the code of that
function, with a nice "dirty hack" comment in it:
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;
}
My question is how do we remove all this code: it is very expensive!
Thanks,
Sebastian
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
More information about the llvm-commits
mailing list