[PATCH] D12719: ScalarEvolution assume hanging bugfix
Sanjoy Das via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 8 20:27:40 PDT 2015
sanjoy added a comment.
I don't think this is an infinite loop (Piotr, can you please verify
this?), it is probably an O(n!) recursion where n == number of the
assumptions.
ScalarEvolution::isImpliedCond already guards for infinite loops via
MarkPendingLoopPredicate. However, if you have
assume_0()
assume_1()
assume_2()
assume_3()
then the recursive call to isImpliedCond(assume_2, X) may end up
calling isImpliedCond(assume_1, Y) and that may end up calling
isImpliedCond(assume_0, Y) and that may end up calling
isImpliedCond(assume_3, Y). This way, even though we're protected
against full on infinite recursion, we'll still explore all 4! = 24
possibilities.
I think the check with LoopContinuePredicate is fine since it only
calls isImpliedCond if there is exactly one latch in the loop. This
means that the above n! possibility is really only a 1! = 1
possibility for LoopContinuePredicate.
But this from memory, so please double check.
http://reviews.llvm.org/D12719
More information about the cfe-commits
mailing list