[PATCH] D61166: [SCEV] Use isKnownViaNonRecursiveReasoning for smax simplification

Keno Fischer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 25 18:14:02 PDT 2019


loladiro created this revision.
loladiro added reviewers: sanjoy, mkazantsev.
Herald added a subscriber: javed.absar.
Herald added a project: LLVM.

Commit
	rL331949 <https://reviews.llvm.org/rL331949>: SCEV] Do not use induction in isKnownPredicate for simplification umax

changed the codepath for umax from isKnownPredicate to
isKnownViaNonRecursiveReasoning to avoid compile time blow up (and as
I found out also stack overflows). However, there is an exact copy of
the code for umax that was lacking this change. In D50167 <https://reviews.llvm.org/D50167> I want to unify
these codepaths, but to avoid that being a behavior change for the smax
case, pull this independent bit out of it.


Repository:
  rL LLVM

https://reviews.llvm.org/D61166

Files:
  lib/Analysis/ScalarEvolution.cpp


Index: lib/Analysis/ScalarEvolution.cpp
===================================================================
--- lib/Analysis/ScalarEvolution.cpp
+++ lib/Analysis/ScalarEvolution.cpp
@@ -3606,10 +3606,10 @@
     //  X smax Y smax Y  -->  X smax Y
     //  X smax Y         -->  X, if X is always greater than Y
     if (Ops[i] == Ops[i+1] ||
-        isKnownPredicate(ICmpInst::ICMP_SGE, Ops[i], Ops[i+1])) {
+        isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_SGE, Ops[i], Ops[i+1])) {
       Ops.erase(Ops.begin()+i+1, Ops.begin()+i+2);
       --i; --e;
-    } else if (isKnownPredicate(ICmpInst::ICMP_SLE, Ops[i], Ops[i+1])) {
+    } else if (isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_SLE, Ops[i], Ops[i+1])) {
       Ops.erase(Ops.begin()+i, Ops.begin()+i+1);
       --i; --e;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61166.196770.patch
Type: text/x-patch
Size: 796 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190426/27301f12/attachment.bin>


More information about the llvm-commits mailing list