[PATCH] D84951: [LV] Try to sink users recursively for first-order recurrences.
Ayal Zaks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 26 14:38:39 PDT 2021
Ayal added inline comments.
================
Comment at: llvm/lib/Analysis/IVDescriptors.cpp:822
+ return false;
}
----------------
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
}
}
```
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