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

Dale Johannesen dalej at apple.com
Sat Apr 19 17:52:10 PDT 2008


On Apr 19, 2008, at 5:38 PM, Chris Lattner wrote:
> On Apr 19, 2008, at 5:32 PM, Dale Johannesen wrote:
>>
>> On Apr 19, 2008, at 5:22 PM, Nick Lewycky wrote:
>>
> Ah ok, good catch :).  I don't think howfartozero is safe to use in
> any case.  If it were, we could just use it in the ULT case too,  
> right?

If you continue with the thread you see Nick has that concern also.   
It is true that the SCEV expression isn't right in that case if the  
loop is never supposed to be executed, but so far every case I've seen  
has a guard test outside the loop proper, so I believe everything  
works (the test I checked in exercises this case).   It may be that  
theoretical considerations mean the SCEV expression is supposed to be  
right in all cases, I'm not sure what its design requirements are.

Another possibility is to remove the UGT case entirely, which was my  
first suggestion.  If you do that the preheader in my test is 2  
instructions, compared to 4 for what's checked in now and 7 for Nick's  
alternative.
I don't imagine that's a win across the board, but I suspect simple  
loops like this are more common than the more complicated ones where  
this optimization is a winner.....




More information about the llvm-commits mailing list