llvm-6502/lib/Transforms/Scalar
Chris Lattner 2e61849f45 fix a small oversight in the "eliminate memcpy from constant global"
optimization.  If the alloca that is "memcpy'd from constant" also has
a memcpy from *it*, ignore it: it is a load.  We now optimize the testcase to:

define void @test2() {
  %B = alloca %T
  %a = bitcast %T* @G to i8*
  %b = bitcast %T* %B to i8*
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %b, i8* %a, i64 124, i32 4, i1 false)
  call void @bar(i8* %b)
  ret void
}

previously we would generate:

define void @test() {
  %B = alloca %T
  %b = bitcast %T* %B to i8*
  %G.0 = getelementptr inbounds %T* @G, i32 0, i32 0
  %tmp3 = load i8* %G.0, align 4
  %G.1 = getelementptr inbounds %T* @G, i32 0, i32 1
  %G.15 = bitcast [123 x i8]* %G.1 to i8*
  %1 = bitcast [123 x i8]* %G.1 to i984*
  %srcval = load i984* %1, align 1
  %B.0 = getelementptr inbounds %T* %B, i32 0, i32 0
  store i8 %tmp3, i8* %B.0, align 4
  %B.1 = getelementptr inbounds %T* %B, i32 0, i32 1
  %B.12 = bitcast [123 x i8]* %B.1 to i8*
  %2 = bitcast [123 x i8]* %B.1 to i984*
  store i984 %srcval, i984* %2, align 1
  call void @bar(i8* %b)
  ret void
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119682 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 06:20:47 +00:00
..
ADCE.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
BasicBlockPlacement.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
CMakeLists.txt Update CMake. 2010-10-08 02:30:03 +00:00
CodeGenPrepare.cpp Inline asm multiple alternative constraints development phase 2 - improved basic logic, added initial platform support. 2010-10-29 17:29:13 +00:00
ConstantProp.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
CorrelatedValuePropagation.cpp Have a few places that want to simplify phi nodes use SimplifyInstruction 2010-11-16 17:41:24 +00:00
DCE.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
DeadStoreElimination.cpp Enhance DSE to handle the case where a free call makes more than 2010-11-12 02:19:17 +00:00
GEPSplitter.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
GVN.cpp Remove dead code in GVN: now that SimplifyInstruction is called 2010-11-17 04:05:21 +00:00
IndVarSimplify.cpp Move SCEV::isLoopInvariant and hasComputableLoopEvolution to be member 2010-11-17 21:23:15 +00:00
JumpThreading.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
LICM.cpp Reference ScalarEvolution by name rather than directly in LICM, 2010-11-17 20:50:07 +00:00
LoopDeletion.cpp Passes do not need to recursively initialize passes that they preserve, if 2010-10-19 20:08:44 +00:00
LoopRotation.cpp Passes do not need to recursively initialize passes that they preserve, if 2010-10-19 20:08:44 +00:00
LoopStrengthReduce.cpp Move SCEV::dominates and properlyDominates to ScalarEvolution. 2010-11-17 21:41:58 +00:00
LoopUnrollPass.cpp Passes do not need to recursively initialize passes that they preserve, if 2010-10-19 20:08:44 +00:00
LoopUnswitch.cpp If dom tree information is available, make it possible to pass 2010-11-14 18:36:10 +00:00
LowerAtomic.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
Makefile make -fno-rtti the default unless a directory builds with REQUIRES_RTTI. 2010-01-24 20:43:08 +00:00
MemCpyOptimizer.cpp Reapply r116831 and r116839, converting AliasAnalysis to use 2010-10-19 22:54:46 +00:00
Reassociate.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
Reg2Mem.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
Scalar.cpp Remove LoopIndexSplit pass. It is neither maintained nor used by anyone. 2010-10-07 23:29:37 +00:00
ScalarReplAggregates.cpp fix a small oversight in the "eliminate memcpy from constant global" 2010-11-18 06:20:47 +00:00
SCCP.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
SimplifyCFGPass.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
SimplifyHalfPowrLibCalls.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
SimplifyLibCalls.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
Sink.cpp Add helper functions for computing the Location of load, store, 2010-11-11 21:50:19 +00:00
TailDuplication.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
TailRecursionElimination.cpp Have a few places that want to simplify phi nodes use SimplifyInstruction 2010-11-16 17:41:24 +00:00