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

Chris Lattner clattner at apple.com
Tue Mar 31 18:06:00 PDT 2009


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
> }

?

-Chris



More information about the llvm-commits mailing list