llvm-6502/lib
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
..
Analysis getEntryFor() may invalidate DenseMap iterator. 2009-03-30 18:34:47 +00:00
Archive
AsmParser Fix a bug in our autoupgrade support: in an argument list to a function 2009-03-25 06:36:36 +00:00
Bitcode Fix internal representation of fp80 to be the 2009-03-23 21:16:53 +00:00
CodeGen Fully general expansion of integer shift of any size. 2009-03-31 19:39:24 +00:00
CompilerDriver -write-graph now can be used with -o. 2009-03-27 12:57:14 +00:00
Debugger Oops...I committed too much. 2009-03-13 04:39:26 +00:00
ExecutionEngine fix one more fp80 case (used only by Interpreter) 2009-03-24 18:16:17 +00:00
Linker Apply ODR linkage changes accidentally dropped during 2009-03-08 13:35:23 +00:00
Support move a large method out of line. 2009-03-28 02:08:47 +00:00
System Add llvm::sys::getHostTriple and remove 2009-03-31 17:30:15 +00:00
Target i128 shift libcalls are not available on x86. 2009-03-31 19:38:51 +00:00
Transforms Throttle back "fold select into operand" transformation. InstCombine should not generate selects of two constants unless they are selects of 0 and 1. 2009-03-31 20:42:45 +00:00
VMCore Fix infinite looping 2009-03-30 15:28:21 +00:00
Makefile Reorganize llvmc code. 2009-03-02 09:01:14 +00:00