llvm-6502/test/Transforms
Duncan Sands bbc7016c60 Transform code like this
%V = mul i64 %N, 4
 %t = getelementptr i8* bitcast (i32* %arr to i8*), i32 %V
into
 %t1 = getelementptr i32* %arr, i32 %N
 %t = bitcast i32* %t1 to i8*
incorporating the multiplication into the getelementptr.
This happens all the time in dragonegg, for example for
  int foo(int *A, int N) {
    return A[N];
  }
because gcc turns this into byte pointer arithmetic before it hits the plugin:
  D.1590_2 = (long unsigned int) N_1(D);
  D.1591_3 = D.1590_2 * 4;
  D.1592_5 = A_4(D) + D.1591_3;
  D.1589_6 = *D.1592_5;
  return D.1589_6;
The D.1592_5 line is a POINTER_PLUS_EXPR, which is turned into a getelementptr
on a bitcast of A_4 to i8*, so this becomes exactly the kind of IR that the
transform fires on.

An analogous transform (with no testcases!) already existed for bitcasts of
arrays, so I rewrote it to share code with this one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166474 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-23 08:28:26 +00:00
..
ADCE
ArgumentPromotion
BBVectorize BBVectorize should ignore unreachable blocks. 2012-10-22 18:00:55 +00:00
BlockPlacement
BranchFolding
CodeExtractor
CodeGenPrepare Move load_to_switch.ll to test/CodeGen/SPARC/ 2012-09-19 09:25:03 +00:00
ConstantMerge
ConstProp
CorrelatedValuePropagation CorrelatedPropagation: BasicBlock::removePredecessor can simplify PHI nodes. If the it's the condition of a SwitchInst, reload it. 2012-09-28 10:42:50 +00:00
DeadArgElim Fix PR14016. 2012-10-09 08:13:15 +00:00
DeadStoreElimination Make this test check the transforms it's actually doing. Also add a test that it 2012-09-25 18:17:38 +00:00
EarlyCSE New EarlyCSE tests for CSE-ing across commutativity. 2012-10-09 16:58:13 +00:00
FunctionAttrs
GlobalDCE
GlobalOpt GlobalOpt: non-constexpr bitcasts or GEPs can occur even if the global value is only stored once. 2012-09-28 10:01:27 +00:00
GVN
IndVarSimplify Indvars: Don't recursively delete instruction during BB iteration. 2012-10-19 17:53:54 +00:00
Inline rename test 2012-09-19 09:22:17 +00:00
InstCombine Transform code like this 2012-10-23 08:28:26 +00:00
InstSimplify
Internalize
IPConstantProp
JumpThreading JumpThreading: when default destination is the destination of some cases in a 2012-09-05 23:45:58 +00:00
LCSSA
LICM
LoopDeletion
LoopIdiom Revert r166390 "LoopIdiom: Replace custom dependence analysis with LoopDependenceAnalysis." 2012-10-21 19:31:16 +00:00
LoopRotate
LoopSimplify
LoopStrengthReduce LSR critical edge splitting fix for PR13756. 2012-09-18 17:51:33 +00:00
LoopUnroll Fix tests that didn't test anything. 2012-09-26 09:51:39 +00:00
LoopUnswitch Fix tests that didn't test anything. 2012-09-26 09:51:39 +00:00
LoopVectorize Don't crash if the load/store pointer is not a GEP. 2012-10-22 18:27:56 +00:00
LowerAtomic
LowerExpectIntrinsic
LowerInvoke
LowerSwitch
Mem2Reg
MemCpyOpt In my recent change to avoid use of underaligned memory I didn't notice that 2012-10-04 13:53:21 +00:00
MergeFunc
MetaRenamer Review feedback from Duncan Sands. Alphabetize includes and simplify 2012-09-14 19:19:57 +00:00
ObjCARC Detect overflow in the path count computation. rdar://12277446. 2012-09-12 20:45:17 +00:00
PhaseOrdering Add test case for r164850. 2012-09-29 00:12:08 +00:00
PruneEH
Reassociate
ScalarRepl
SCCP
SimplifyCFG SimplifyCFG: Enhance the "remove CFG edge that leads to null pointer dereference" optimization to also handle instructions with multiple uses. 2012-10-04 16:11:49 +00:00
SimplifyLibCalls SimplifyLibcalls: The return value of ffsll is always i32, even when the input is zero. 2012-10-19 20:43:44 +00:00
Sink
SROA This just in, it is a *bad idea* to use 'udiv' on an offset of 2012-10-17 09:23:48 +00:00
StripSymbols
TailCallElim Revert r166407 because it caused analyzer tests to crash and broke self-host bots. 2012-10-22 18:16:14 +00:00
TailDup