[PATCH] D125990: [LSR] Fix bug for optimizing unused IVs to final values
Michael Kruse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 23 14:04:21 PDT 2022
Meinersbur requested changes to this revision.
Meinersbur added inline comments.
This revision now requires changes to proceed.
================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:5605
+// potentially be optimized with a call to rewriteLoopExitValue.
+static bool IsIndVarWithSingleUse(Loop *L, ScalarEvolution &SE) {
BasicBlock *ExitBB = L->getExitBlock();
----------------
[style] [[ https://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly | Function names should start with lower case ]].
================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:5627
if (IVNext->getNumUses() == 2)
return true;
}
----------------
Since this immediately returns true, no other non-induction phi is being considered. I.e. the test depends on the ordering of `ExitBB->phis()`.
That's already a problem with the `if (ExitPhi.getNumIncomingValues() != 1) break;` test. Isn't here are more conceptional condition, such that all uses are recognized inductions by SCEV instead counting the number of uses?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125990/new/
https://reviews.llvm.org/D125990
More information about the llvm-commits
mailing list