IRCE expects true edge of range check's branch comes to loop.
If it meets reverse case - invert the branch.
Details
Diff Detail
Event Timeline
| llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
|---|---|---|
| 378 | 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 | ||
|---|---|---|
| 374 | 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:
| |
| 1901 | Is it Dead variable? | |
| llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
|---|---|---|
| 374 | No operand idx but successor idx... | |
| llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
|---|---|---|
| 374 | Good point, thanks! | |
| 1901 | 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 | ||
|---|---|---|
| 389 | 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: