[PATCH] D118090: [ScalarEvolution] Handle <= and >= in non infinite loops
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 27 13:25:53 PST 2022
reames added inline comments.
================
Comment at: llvm/lib/Analysis/LoopInfo.cpp:1122
+ return L->getHeader()->getParent()->mustProgress() || hasMustProgress(L) ||
+ isFinite(L);
}
----------------
This is - in the current patch - a form of attribute inference. We prefer inference be done once - either in the core API itself, or explicitly via materialization in IR - not duplicated for each consumer.
i.e. Calling code should assume that willreturn loops are mustprogress, not check for that case explicitly.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:7020
// side effects which are well defined in infinite loops.
- return isMustProgress(L) && loopHasNoSideEffects(L);
+ return isFinite(L) || (isMustProgress(L) && loopHasNoSideEffects(L));
}
----------------
This change by itself should be testable and profitable. I'd advise separating the SimplifyICmpOperands bits into a following change.
Or said differently, a patch which causes loopIsFiniteByAssumption for loops in willreturn functions seems entirely reasonable on it's own without any new metadata.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118090/new/
https://reviews.llvm.org/D118090
More information about the llvm-commits
mailing list