Evan Cheng de62192843 Throttle back "fold select into operand" transformation. InstCombine should not generate selects of two constants unless they are selects of 0 and 1.
e.g.
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
}

was turned into

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
}

For most targets, that means materializing two constants and then a select. e.g. On x86-64

movl    %esi, %eax
shrl    $18, %eax
testl   %edi, %edi
cmovne  %esi, %eax
ret

=>

xorl    %eax, %eax
testl   %edi, %edi
movl    $18, %ecx
cmovne  %eax, %ecx
movl    %esi, %eax
shrl    %cl, %eax
ret

Also, the optimizer and codegen can reason about shl / and / add, etc. by a constant. This optimization will hinder optimizations using ComputeMaskedBits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 20:42:45 +00:00
..
2007-04-14 20:13:02 +00:00
2007-01-26 08:25:06 +00:00
2007-04-14 20:13:02 +00:00
2007-04-14 20:13:02 +00:00
2007-04-14 20:13:02 +00:00
2007-04-14 20:13:02 +00:00
2007-04-14 20:13:02 +00:00
2007-04-15 07:38:21 +00:00
2007-04-14 20:13:02 +00:00
2007-04-14 20:13:02 +00:00
2007-05-05 01:59:05 +00:00
2007-05-19 06:50:37 +00:00
2007-11-08 18:45:15 +00:00
2007-11-22 23:47:13 +00:00
2007-12-12 15:21:32 +00:00
2008-03-06 06:50:03 +00:00
2008-05-18 04:11:26 +00:00
2008-05-31 17:10:28 +00:00
2008-07-12 05:04:38 +00:00
2008-07-17 06:07:20 +00:00
2009-01-24 17:16:04 +00:00
2009-02-02 06:55:45 +00:00
2009-02-25 18:20:01 +00:00
2008-05-20 05:46:13 +00:00
2008-03-09 08:16:40 +00:00
2007-04-14 20:13:02 +00:00
2007-04-15 07:38:21 +00:00
2007-04-15 07:38:21 +00:00
2007-04-15 07:38:21 +00:00
2007-04-15 07:38:21 +00:00
2007-04-14 20:13:02 +00:00
2007-04-14 18:30:06 +00:00
2007-04-14 18:30:06 +00:00
2007-04-14 20:13:02 +00:00
2007-03-26 10:59:13 +00:00
2007-04-14 20:13:02 +00:00
2007-04-14 20:13:02 +00:00
2007-04-14 20:13:02 +00:00
2007-04-14 20:13:02 +00:00
2007-04-14 20:13:02 +00:00
2007-04-14 20:13:02 +00:00
2007-04-14 20:13:02 +00:00
2007-04-15 07:38:21 +00:00
2007-04-14 20:13:02 +00:00
2007-04-14 20:13:02 +00:00
2007-04-14 18:33:31 +00:00
2007-04-14 20:13:02 +00:00
2008-05-16 02:59:42 +00:00
2008-03-25 04:26:08 +00:00
2007-04-14 20:13:02 +00:00
2007-10-12 05:29:53 +00:00
2007-04-14 20:13:02 +00:00
2007-04-06 18:56:54 +00:00
2007-08-06 20:04:16 +00:00
2008-05-09 05:19:28 +00:00
2002-08-03 20:24:45 +00:00
2008-03-09 08:16:40 +00:00
2009-03-24 18:15:30 +00:00
2007-04-14 23:00:51 +00:00
2007-04-14 20:13:02 +00:00
2007-04-15 07:38:21 +00:00
2007-04-14 20:13:02 +00:00
2008-03-09 08:16:40 +00:00

This directory contains test cases for the instcombine transformation.  The
dated tests are actual bug tests, whereas the named tests are used to test
for features that the this pass should be capable of performing.