[PATCH] D86696: [Attributor][WIP] Introduce Loop AA
Stefanos Baziotis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 27 05:52:01 PDT 2020
baziotis added inline comments.
================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:7942
+ for (Instruction &I : *HeaderBB) {
+ if (auto *BI = dyn_cast<BranchInst>(&I)) {
+ auto *Op = BI->getOperand(0);
----------------
Instead of looping every instruction, you can use [[ https://llvm.org/doxygen/classllvm_1_1BasicBlock.html#a71a9eabc4318b2fc34f83b01dfee484b | getTerminator() ]] and check if it's a branch.
================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:7943
+ if (auto *BI = dyn_cast<BranchInst>(&I)) {
+ auto *Op = BI->getOperand(0);
+ const auto &OpAA =
----------------
For that to make sense, you have to verify that the branch `isConditional()`. Also, note that loops
may be [[ https://llvm.org/docs/LoopTerminology.html#rotated-loops | rotated ]]. In that case, the condition is not in the header block, but in the latch.
Generally, loops can get quite complicated and so, as Kuter said, you probably want to use
SCEV (for example, backedge taken count etc.) I'll have to think that again because SCEV
won't benefit from Attributor, meaning, at a high-level, using constant range AA when it makes
sense seems reasonable.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86696/new/
https://reviews.llvm.org/D86696
More information about the llvm-commits
mailing list