[PATCH] D3127: [ScalarEvolution]Fix PR18607 resulting in long compilation time and memory usage

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 20:21:33 PDT 2016


mehdi_amini added inline comments.

================
Comment at: lib/Analysis/ScalarEvolution.cpp:545
@@ -544,3 +544,3 @@
           return (int)LBitWidth - (int)RBitWidth;
-        return LA.ult(RA) ? -1 : 1;
+        return LA.ult(RA) ? -1 : (LA.eq(RA) ? 0 : 1);
       }
----------------
Is it related to the threshold defined in this patch?
Otherwise it should be a separate patch.

================
Comment at: lib/Analysis/ScalarEvolution.cpp:594
@@ -594,3 +593,3 @@
         }
-        return (int)LNumOps - (int)RNumOps;
+        return 0;
       }
----------------
Same.

================
Comment at: lib/Analysis/ScalarEvolution.cpp:1967
@@ +1966,3 @@
+      // Add a threshold to check the same.
+      if((Ops.size() + Mul->getNumOperands() -1) > 512)
+        break;
----------------
512 is you threshold right? Usually I believe we use a cl::opt with a default value for such things.

================
Comment at: test/Transforms/IndVarSimplify/pr18607.ll:1
@@ +1,2 @@
+; RUN: opt < %s -indvars -disable-output -S  
+
----------------
A test without output is not great.
With a cl::opt threshold you should be able to have a simpler case and run it with two threshold and check how the SCEV that is printed changes


https://reviews.llvm.org/D3127





More information about the llvm-commits mailing list