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

Dale Johannesen dalej at apple.com
Sat Apr 19 12:29:47 PDT 2008


That seems to work equally well, but results in noticeably worse code,  
7 instructions instead of 4 in the preheader in my example test.   
Could you explain why what we did was wrong?

On Apr 18, 2008, at 9:27 PM, Nick Lewycky wrote:

> Hi Dale,
>
> I don't think this is right. The correct fix is to replace
> getNegativeSCEV with getNotSCEV.
>
> Nick
>
> Dale Johannesen wrote:
>> Author: johannes
>> Date: Fri Apr 18 16:38:31 2008
>> New Revision: 49928
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=49928&view=rev
>> Log:
>> Fix a scalar evolution bug.  Reversing everything
>> does not work because of 0; 2>0 but -2U is also >0.
>>
>>
>> Modified:
>>    llvm/trunk/lib/Analysis/ScalarEvolution.cpp
>>
>> Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=49928&r1=49927&r2=49928&view=diff
>>
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
>> +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Fri Apr 18 16:38:31  
>> 2008
>> @@ -1980,8 +1980,7 @@
>>     break;
>>   }
>>   case ICmpInst::ICMP_UGT: {
>> -    SCEVHandle TC = HowManyLessThans(SE.getNegativeSCEV(LHS),
>> -                                     SE.getNegativeSCEV(RHS), L,  
>> false);
>> +    SCEVHandle TC = HowFarToZero(SE.getMinusSCEV(LHS, RHS), L);
>>     if (!isa<SCEVCouldNotCompute>(TC)) return TC;
>>     break;
>>   }
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list