[PATCH] D118090: [ScalarEvolution] Handle <= and >= in non infinite loops

William Moses via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 27 20:54:38 PST 2022


wsmoses added inline comments.


================
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));
 }
----------------
reames wrote:
> 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.  
I've made a version of this PR that just contains the isFinite component here (https://reviews.llvm.org/D118429) though frankly I'm not sure how to set up a test for it.


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