[PATCH] D12719: ScalarEvolution assume hanging bugfix
Richard Smith via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 11:30:47 PDT 2015
rsmith added a comment.
In http://reviews.llvm.org/D12719#242218, @sanjoy wrote:
> I think @rsmith is right -- in this case the complexity is O(n^2). I thought I had an example where it was O(n!), but I cannot come with anything concrete right now.
Our initial analysis of the 'assume' problem appeared to be O(n!), but we don't have a reduced testcase for that. The cycle there was `isLoopBackedgeGuardedByCond` -> `isImpliedCond` -> `getZeroExtendExpr` -> `isLoopBackedgeGuardedByCond`. In the testcase in this patch, `getZeroExtendExpr` memoizes its result, but there are paths through it that do not appear to do so (in particular, the `isLoopBackedgeGuardedByCond` test in the `isKnownPositive` / `isKnownNegative` cases can lead to a `return` with no memoization of the `getZeroExtendExpr` result).
I could easily believe there are testcases for both loops that lead to O(n!) performance. (If not, we are emitting /vastly/ too many assumes...)
http://reviews.llvm.org/D12719
More information about the llvm-commits
mailing list