1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00
llvm-mirror/lib
Chris Lattner 6c01df15ac Enhance the shift-shift folding code to allow a no-op cast to occur in between
the shifts.

This allows us to fold this (which is the 'integer add a constant' sequence
from cozmic's scheme compmiler):

int %x(uint %anf-temporary776) {
        %anf-temporary777 = shr uint %anf-temporary776, ubyte 1
        %anf-temporary800 = cast uint %anf-temporary777 to int
        %anf-temporary804 = shl int %anf-temporary800, ubyte 1
        %anf-temporary805 = add int %anf-temporary804, -2
        %anf-temporary806 = or int %anf-temporary805, 1
        ret int %anf-temporary806
}

into this:

int %x(uint %anf-temporary776) {
        %anf-temporary776 = cast uint %anf-temporary776 to int
        %anf-temporary776.mask1 = add int %anf-temporary776, -2
        %anf-temporary805 = or int %anf-temporary776.mask1, 1
        ret int %anf-temporary805
}

note that instcombine already knew how to eliminate the AND that the two
shifts fold into.  This is tested by InstCombine/shift.ll:test26

-Chris

llvm-svn: 25128
2006-01-06 07:52:12 +00:00
..
Analysis Make the -print-alias-sets pass work for printing out something other than 2006-01-03 06:05:22 +00:00
AsmParser Regenerate 2005-12-21 18:31:50 +00:00
Bytecode more C++ daintiness 2005-12-26 14:31:26 +00:00
CodeGen Unbreak the build :( 2006-01-06 05:47:48 +00:00
Debugger dum de dum 2005-12-26 10:24:15 +00:00
ExecutionEngine Fix a nasty bug that was causing miscompilation of global variables 2005-10-23 23:54:56 +00:00
Linker Adjust the constructor to the Linker class to take an argument that names 2005-12-13 20:00:37 +00:00
Support HP aCC chokes on this, but it's not required anyway: according to 2005-12-26 05:00:25 +00:00
System For PR351: 2005-12-22 20:00:16 +00:00
Target Addd (shl x, 1) ==> (shl x, x) peepholes. 2006-01-06 02:31:59 +00:00
Transforms Enhance the shift-shift folding code to allow a no-op cast to occur in between 2006-01-06 07:52:12 +00:00
VMCore Implement a few symbolic constant folding things. X ? Y : Y is Y. 2006-01-05 07:49:30 +00:00
Makefile Add the Linker library 2004-11-14 21:54:41 +00:00