[llvm-commits] [llvm] r141161 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Andrew Trick atrick at apple.com
Tue Oct 4 23:18:07 PDT 2011


On Oct 4, 2011, at 11:10 PM, Nick Lewycky wrote:

> On 10/04/2011 08:25 PM, Andrew Trick wrote:
>> Author: atrick
>> Date: Tue Oct  4 22:25:31 2011
>> New Revision: 141161
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=141161&view=rev
>> Log:
>> Avoid exponential recursion in SCEV getConstantEvolvingPHI and EvaluateExpression.
>> 
>> Note to compiler writers: never recurse on multiple instruction
>> operands without memoization.
>> Fixes rdar://10187945. Was taking 45s, now taking 5ms.
> 
> Ugh. Sorry for adding this, I really didn't think this would be a problem in practice. Thanks for handling the fallout! Feel free to ask me to clean up my own performance problems too, if you like :)


Now I know who it was... I think a fair penalty would be to find any other places where we make recursive calls on operands or use lists without a visited set. After all, they're fun to fix.

Incidentally, you'll see my fix is nicely compatible with your proposed patch to the same code.

-Andy



More information about the llvm-commits mailing list