[PATCH] D146792: [LoopPredication] Do not sink conditions to branches. PR61673
Anna Thomas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 5 14:37:54 PDT 2023
anna added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/LoopPredication.cpp:1188
- // Subtlety: We need to avoid inserting additional uses of the WC. We know
- // that it can only have one transitive use at the moment, and thus moving
- // that use to just before the branch and inserting code before it and then
- // modifying the operand is legal.
- auto *IP = cast<Instruction>(WidenableBR->getCondition());
- // Here we unconditionally modify the IR, so after this point we should return
- // only `true`!
- IP->moveBefore(WidenableBR);
- if (MSSAU)
- if (auto *MUD = MSSAU->getMemorySSA()->getMemoryAccess(IP))
- MSSAU->moveToPlace(MUD, WidenableBR->getParent(),
- MemorySSA::BeforeTerminator);
- Rewriter.setInsertPoint(IP);
- IRBuilder<> B(IP);
+ Rewriter.setInsertPoint(WidenableBR);
+ IRBuilder<> B(WidenableBR);
----------------
We should not widen at the branch, but rather at the widenable call. This is handled in the patch referenced above.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146792/new/
https://reviews.llvm.org/D146792
More information about the llvm-commits
mailing list