aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-02-09 14:26:06 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-02-09 14:26:06 +0000
commitd4692747439aac1fbc2064e11b53e3e6ea5ad463 (patch)
treec23eb536941b06a60c06a0af6e13d4db31fdc2a2 /test/Transforms
parent2c6ae095b8a944c8355377498b9ad11bb94af2d5 (diff)
downloadexternal_llvm-d4692747439aac1fbc2064e11b53e3e6ea5ad463.zip
external_llvm-d4692747439aac1fbc2064e11b53e3e6ea5ad463.tar.gz
external_llvm-d4692747439aac1fbc2064e11b53e3e6ea5ad463.tar.bz2
GlobalOpt: Be more aggressive about elminating side-effect free static dtors.
GlobalOpt runs early in the pipeline (before inlining) and complex class hierarchies often introduce bitcasts or GEPs which weren't optimized away. Teach it to ignore side-effect free instructions instead of depending on other passes to remove them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150174 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/GlobalOpt/cxx-dtor.ll6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/Transforms/GlobalOpt/cxx-dtor.ll b/test/Transforms/GlobalOpt/cxx-dtor.ll
index 2263562..7c6ae78 100644
--- a/test/Transforms/GlobalOpt/cxx-dtor.ll
+++ b/test/Transforms/GlobalOpt/cxx-dtor.ll
@@ -2,6 +2,7 @@
%0 = type { i32, void ()* }
%struct.A = type { i8 }
+%struct.B = type { }
@a = global %struct.A zeroinitializer, align 1
@__dso_handle = external global i8*
@@ -15,13 +16,14 @@ define internal void @__cxx_global_var_init() nounwind section "__TEXT,__StaticI
}
define linkonce_odr void @_ZN1AD1Ev(%struct.A* %this) nounwind align 2 {
- call void @_ZN1AD2Ev(%struct.A* %this)
+ %t = bitcast %struct.A* %this to %struct.B*
+ call void @_ZN1BD1Ev(%struct.B* %t)
ret void
}
declare i32 @__cxa_atexit(void (i8*)*, i8*, i8*)
-define linkonce_odr void @_ZN1AD2Ev(%struct.A* %this) nounwind align 2 {
+define linkonce_odr void @_ZN1BD1Ev(%struct.B* %this) nounwind align 2 {
ret void
}