llvm-6502/lib/Transforms/Scalar
Chris Lattner 10d514ee58 enhance the compare/load/index optimization to work on *any* load
from a global with 32/64 elements or less (depending on whether
i64 is native on the target), generating a bitshift idiom to 
determine the result.  For example, on test4 we produce:

define i1 @test4(i32 %X) {
  %1 = lshr i32 933, %X                           ; <i32> [#uses=1]
  %2 = and i32 %1, 1                              ; <i32> [#uses=1]
  %R = icmp ne i32 %2, 0                          ; <i1> [#uses=1]
  ret i1 %R
}

This triggers in a number of interesting cases, for example, here's an
fp case:
@A.3255 = internal constant [4 x double] [double 4.100000e+00, double -3.900000e+00, double -1.000000e+00, double 1.000000e+00], align 32 ; <[4 x double]*> [#uses=7]
...
	   %7 = fcmp olt double %3, 0.000000e+00

In this case we make the slen2_tab global dead, which is nice:
@slen2_tab = internal constant [16 x i32] [i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3, i32 1, i32 2, i32 3, i32 1, i32 2, i32 3, i32 2, i32 3], align 32 ; <[16 x i32]*> [#uses=1]
...
	   %204 = icmp eq i32 %46, 0     

Perl has a bunch of these, also on the 'Perl_regkind' array:
@Perl_yygindex = internal constant [51 x i16] [i16 0, i16 0, i16 0, i16 0, i16 374, i16 351, i16 0, i16 -12, i16 0, i16 946, i16 413, i16 -83, i16 0, i16 0, i16 0, i16 -311, i16 -13, i16 4007, i16 2893, i16 0, i16 0, i16 0, i16 0, i16 0, i16 372, i16 -8, i16 0, i16 0, i16 246, i16 -131, i16 43, i16 86, i16 208, i16 -45, i16 -169, i16 987, i16 0, i16 0, i16 0, i16 0, i16 308, i16 0, i16 -271, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0], align 32 ; <[51 x i16]*> [#uses=1]
...
  %1364 = icmp eq i16 %1361, 0

186.crafty really likes this on 64-bit machines, because it triggers on a bunch of globals like this:
@white_outpost = internal constant [64 x i8] c"\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\02\02\00\00\00\00\00\04\05\05\04\00\00\00\00\03\06\06\03\00\00\00\00\00\01\01\00\00\00\00\00\00\00\00\00\00\00", align 32 ; <[64 x i8]*> [#uses=2]

However the big winner is 403.gcc, which triggers hundreds of times, eliminating all the accesses to the 57-element arrays 'mode_class', mode_unit_size, mode_bitsize, regclass_map, etc.

go 64-bit machines :)




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92415 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-02 08:56:52 +00:00
..
ABCD.cpp Fix DenseMap iterator constness. 2009-11-10 01:02:17 +00:00
ADCE.cpp eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861 2009-09-02 06:11:42 +00:00
BasicBlockPlacement.cpp eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861 2009-09-02 06:11:42 +00:00
CMakeLists.txt remove the now dead condprop pass, PR3906. 2009-11-11 05:56:35 +00:00
CodeGenPrepare.cpp Revert 91280-91283, 91286-91289, 91291, 91293, 91295-91296. It apparently introduced a non-deterministic behavior in the optimizer somewhere. 2009-12-17 09:39:49 +00:00
ConstantProp.cpp remove a bunch of extraneous LLVMContext arguments 2009-11-06 04:27:31 +00:00
DCE.cpp eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861 2009-09-02 06:11:42 +00:00
DeadStoreElimination.cpp formatting cleanups. 2009-12-02 06:35:55 +00:00
GEPSplitter.cpp Check in the experimental GEP splitter pass. This pass splits complex 2009-10-26 19:12:14 +00:00
GVN.cpp split code that doesn't need to be templated out of IRBuilder into a new 2009-12-28 21:28:46 +00:00
IndVarSimplify.cpp Add Loop contains utility methods for testing whether a loop 2009-12-18 01:24:09 +00:00
InstructionCombining.cpp enhance the compare/load/index optimization to work on *any* load 2010-01-02 08:56:52 +00:00
JumpThreading.cpp Metadata.h doesn't need to include ValueHandle.h anymore. 2009-12-28 08:20:46 +00:00
LICM.cpp Add Loop contains utility methods for testing whether a loop 2009-12-18 01:24:09 +00:00
LoopDeletion.cpp LoopDeletion depends on loops having dedicated exits. 2009-11-05 21:47:04 +00:00
LoopIndexSplit.cpp Add Loop contains utility methods for testing whether a loop 2009-12-18 01:24:09 +00:00
LoopRotation.cpp Update various Loop optimization passes to cope with the possibility that 2009-11-05 21:11:53 +00:00
LoopStrengthReduce.cpp Remove dump routine and the associated Debug.h from a header. Patch up 2009-12-23 22:58:38 +00:00
LoopUnrollPass.cpp Replace LoopUnrollPass.cpp's custom code-size estimation code using 2009-10-31 14:54:17 +00:00
LoopUnswitch.cpp Add Loop contains utility methods for testing whether a loop 2009-12-18 01:24:09 +00:00
Makefile Removed trailing whitespace from Makefiles. 2009-01-09 16:44:42 +00:00
MemCpyOptimizer.cpp Introduce and use convenience methods for getting pointer types 2009-10-06 15:40:36 +00:00
Reassociate.cpp When factoring multiply expressions across adds, factor both 2010-01-01 01:13:15 +00:00
Reg2Mem.cpp clean up this code a bit. 2009-09-02 06:15:37 +00:00
Scalar.cpp remove the now dead condprop pass, PR3906. 2009-11-11 05:56:35 +00:00
ScalarReplAggregates.cpp Fix the Convert to scalar to not insert dead loads in the store case. The 2009-12-22 19:33:28 +00:00
SCCP.cpp Fix a use of an invalidated iterator in the case where there are multiple 2009-11-23 16:13:39 +00:00
SCCVN.cpp Eliminte unnecessary uses of <cstdio>. 2009-12-18 03:25:51 +00:00
SimplifyCFGPass.cpp Implement PR5795 by merging duplicated return blocks. This could go further 2009-12-22 06:07:30 +00:00
SimplifyHalfPowrLibCalls.cpp improve portability to avoid conflicting with std::next in c++'0x. 2009-12-03 00:50:42 +00:00
SimplifyLibCalls.cpp move an optimization for memcmp out of simplifylibcalls and into 2009-12-24 00:37:38 +00:00
TailDuplication.cpp remove a bunch of extraneous LLVMContext arguments 2009-11-06 04:27:31 +00:00
TailRecursionElimination.cpp Improve tail call elimination to handle the switch statement. 2009-11-07 21:10:15 +00:00