[PATCH] D84951: [LV] Try to sink users recursively for first-order recurrences.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 26 14:48:27 PDT 2021
fhahn added inline comments.
================
Comment at: llvm/lib/Analysis/IVDescriptors.cpp:822
+ return false;
}
----------------
Ayal wrote:
> Perhaps the logic could be simplified somewhat, compressed to see it all together here:
>
> ```
> WorkList = { Phi }
> while WorkList not empty {
> Insn = pop from WorkList
> for (User *User : Insn->users()) {
> // Cyclic dependence
> if (Previous == User)
> return false;
> // No need to sink User
> if (DT->dominates(Previous, User) ||
> isa<PHINode>(User))
> continue;
> // Cannot sink User
> if ((User->getParent() != PhiBB) ||
> User->mayHaveSideEffects() ||
> User->mayReadFromMemory() ||
> (User->getParent()->getTerminator() == User) ||
> (SinkAfter.find(User) != SinkAfter.end()))
> return false;
> // Sink User tentatively and check its users
> if InstsToSink.insert(User)
> append User to Worklist
> }
> }
> ```
Thanks! I adjusted/compacted the code as suggested, but with keeping the check if the instruction has been sunk already and the assertion is UserI is a PHINode.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84951/new/
https://reviews.llvm.org/D84951
More information about the llvm-commits
mailing list