[PATCH] D88210: [IndVars] Use knowledge about execution on last iteration when removing checks
Evgeniy via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 30 03:18:46 PDT 2020
ebrevnov requested changes to this revision.
ebrevnov added inline comments.
This revision now requires changes to proceed.
================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:2433
auto *BI = cast<BranchInst>(ExitingBB->getTerminator());
- auto OptimizeCond = [&](bool Inverted) {
- if (isTrivialCond(L, BI, SE, Inverted, MaxExitCount)) {
+ auto OptimizeCond = [&](bool Inverted, bool SkipLastIter) {
+ const SCEV *MaxIter = MaxExitCount;
----------------
NIT1: please list all captured values explicitly. Maybe capture SkipLastIter by value?
NIT2: please think of moving handling of SkipLastIter case to this lambda. In this case we will "hide" complexity from the main loop.
================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:2437
+ const SCEV *One = SE->getOne(MaxIter->getType());
+ MaxIter = SE->getMinusSCEV(MaxIter, One);
+ }
----------------
This lambda may be called twice with SkipLastIter equal to true for each exit. As a result MaxIter may be decremented by 2 for particular exit.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88210/new/
https://reviews.llvm.org/D88210
More information about the llvm-commits
mailing list