[PATCH] D92745: [LoopIdiomRecognize] Teach detectShiftUntilZeroIdiom to recognize loops where the counter is decrementing.
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 7 02:25:11 PST 2020
lebedev.ri added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1484-1489
for (BasicBlock::iterator Iter = LoopEntry->getFirstNonPHI()->getIterator(),
IterE = LoopEntry->end();
Iter != IterE; Iter++) {
Instruction *Inst = &*Iter;
if (Inst->getOpcode() != Instruction::Add)
continue;
----------------
craig.topper wrote:
> lebedev.ri wrote:
> > Preexisting problem, but this is //kinda// broken.
> > If we have a second `add` in the loop,
> > and it happens to be before the one we are looking for,
> > we'll fail to detect the idiom.
> > The detection should not involve linear scan over instructions.
> All the fails are continues. So wouldn’t the second add also have to be a recurrence with 1/-1?
I guess, but still, this is broken:
https://godbolt.org/z/fzoo61
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92745/new/
https://reviews.llvm.org/D92745
More information about the llvm-commits
mailing list