[PATCH] D12719: ScalarEvolution assume hanging bugfix

Piotr Padlewski via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 8 22:28:51 PDT 2015


Prazek added a comment.

I checked it, it is of course not infinite. I am not sure about n! in case of assumes. I having 10 or 20 assumes will not make it slow. @rsmith was helping me with it, and he thinks that for assumes it is O(n^2), because results are memorized.

So it this case, 1000 assumes is enough to make difference


================
Comment at: lib/Analysis/ScalarEvolution.cpp:6980
@@ -6991,1 +6979,3 @@
 
+  // Check conditions due to any @llvm.assume intrinsics.
+  for (auto &AssumeVH : AC.assumptions()) {
----------------
nlewycky wrote:
> Prazek wrote:
> > nlewycky wrote:
> > > What is it about this check which is a problem? Or put another way, why is this not okay but the call to isImpliedCond on line 6956 is fine? The problem is recursion through isImpliedCond->getSCEV->..., right?
> > The problem is that the check wasn't covering assume loop which caused big hang.
> > 
> > Stacktrace looked more like this
> > (isImpliedCond -> getZeroExtendExpr -> isLoopBackedgeGuardedByCond) x much
> Does the code from 6953 to 6959 need to move below this check too? Is there another bug here?
I don't think so. I think the results are memorized, so calling sImpliedCond in 6956 will not cause lag.


http://reviews.llvm.org/D12719





More information about the cfe-commits mailing list