[llvm] [SCEV] Use context sensative reasoning in howFarToZero (PR #94525)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 19 08:32:54 PDT 2024
================
@@ -10533,6 +10536,13 @@ ScalarEvolution::ExitLimit ScalarEvolution::howFarToZero(const SCEV *V,
// will have undefined behavior due to wrapping.
if (ControlsOnlyExit && AddRec->hasNoSelfWrap() &&
loopHasNoAbnormalExits(AddRec->getLoop())) {
+
+ // If the stride is zero, the loop must be infinite. Most loops are
+ // finite by assumption, in which case the step being zero implies UB
----------------
nikic wrote:
"Most loops are finite by assumption" is a C++-ism...
https://github.com/llvm/llvm-project/pull/94525
More information about the llvm-commits
mailing list