IRCE expects true edge of range check's branch comes to loop.
If it meets reverse case - invert the branch.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
401 | You can modify IR at this point and then return false here: for (auto *BBI : L->getBlocks()) if (BranchInst *TBI = dyn_cast<BranchInst>(BBI->getTerminator())) InductiveRangeCheck::extractRangeChecksFromBranch(TBI, L, SE, BPI, RangeChecks); if (RangeChecks.empty()) return false; it would mean that you modify IR and then report that no modification was done and all analyzes can be preserved, which is wrong. |
llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
397 | Can we move this transformation AFTER profitability check? The idea is that if we will not add this check to consideration, no need to do modification. I guess it should work:
| |
1925–1926 | Is it Dead variable? |
llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
397 | No operand idx but successor idx... |
llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
397 | Good point, thanks! | |
1925–1926 | Yeap, removed https://reviews.llvm.org/D154391 |
In the commit message adds a couple of words about the reason - IRCE expects that true branch comes to loop.
llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
405 | dot at the end, please. |
Can we move this transformation AFTER profitability check? The idea is that if we will not add this check to consideration, no need to do modification.
I guess it should work: