[llvm-commits] [llvm] r68142 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/select-2.ll

Evan Cheng evan.cheng at apple.com
Tue Mar 31 18:20:28 PDT 2009


On Mar 31, 2009, at 6:06 PM, Chris Lattner wrote:

>
> On Mar 31, 2009, at 1:42 PM, Evan Cheng wrote:
>
>> Author: evancheng
>> Date: Tue Mar 31 15:42:45 2009
>> New Revision: 68142
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=68142&view=rev
>> Log:
>> Throttle back "fold select into operand" transformation. InstCombine
>> should not generate selects of two constants unless they are selects
>> of 0 and 1.
>
> Ok, nice.  Should instcombine try to fold the other way?  If it sees:
>
>> define i32 @t2(i32 %c, i32 %x) nounwind {
>>      %t1 = icmp eq i32 %c, 0
>>      %t2 = select i1 %t1, i32 18, i32 0
>>      %t3 = lshr i32 %x, %t2
>>      ret i32 %t3
>> }
>
> should it turn it into:
>
>> define i32 @t1(i32 %c, i32 %x) nounwind {
>>      %t1 = icmp eq i32 %c, 0
>>      %t2 = lshr i32 %x, 18
>>      %t3 = select i1 %t1, i32 %t2, i32 %x
>>      ret i32 %t3
>> }
>
> ?

Yes, it's probably a win.

Evan

>
>
> -Chris
> _______________________________________________
> 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