Reduce and merge testcases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123579 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2011-01-16 09:13:31 +00:00
parent dec28ceb02
commit 29c8419f91
2 changed files with 16 additions and 60 deletions

View File

@ -1,5 +1,5 @@
; RUN: opt < %s -globalopt -S | not grep CTOR
@llvm.global_ctors = appending global [10 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @CTOR1 }, { i32, void ()* } { i32 65535, void ()* @CTOR1 }, { i32, void ()* } { i32 65535, void ()* @CTOR2 }, { i32, void ()* } { i32 65535, void ()* @CTOR3 }, { i32, void ()* } { i32 65535, void ()* @CTOR4 }, { i32, void ()* } { i32 65535, void ()* @CTOR5 }, { i32, void ()* } { i32 65535, void ()* @CTOR6 }, { i32, void ()* } { i32 65535, void ()* @CTOR7 }, { i32, void ()* } { i32 65535, void ()* @CTOR8 }, { i32, void ()* } { i32 2147483647, void ()* null } ] ; <[10 x { i32, void ()* }]*> [#uses=0]
@llvm.global_ctors = appending global [11 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @CTOR1 }, { i32, void ()* } { i32 65535, void ()* @CTOR1 }, { i32, void ()* } { i32 65535, void ()* @CTOR2 }, { i32, void ()* } { i32 65535, void ()* @CTOR3 }, { i32, void ()* } { i32 65535, void ()* @CTOR4 }, { i32, void ()* } { i32 65535, void ()* @CTOR5 }, { i32, void ()* } { i32 65535, void ()* @CTOR6 }, { i32, void ()* } { i32 65535, void ()* @CTOR7 }, { i32, void ()* } { i32 65535, void ()* @CTOR8 }, { i32, void ()* } { i32 65535, void ()* @CTOR9 }, { i32, void ()* } { i32 2147483647, void ()* null } ] ; <[10 x { i32, void ()* }]*> [#uses=0]
@G = global i32 0 ; <i32*> [#uses=1]
@G2 = global i32 0 ; <i32*> [#uses=1]
@G3 = global i32 -123 ; <i32*> [#uses=2]
@ -83,3 +83,18 @@ define i1 @accessor() {
%V = load i1* @CTORGV ; <i1> [#uses=1]
ret i1 %V
}
%struct.A = type { i32 }
%struct.B = type { i32 (...)**, i8*, [4 x i8] }
@GV1 = global %struct.B zeroinitializer, align 8
@GV2 = constant [3 x i8*] [i8* inttoptr (i64 16 to i8*), i8* null, i8* bitcast ({ i8*, i8*, i32, i32, i8*, i64 }* null to i8*)]
; CHECK-NOT: CTOR9
define internal void @CTOR9() {
entry:
%0 = bitcast %struct.B* @GV1 to i8*
%1 = getelementptr inbounds i8* %0, i64 16
%2 = bitcast i8* %1 to %struct.A*
%3 = bitcast %struct.B* @GV1 to i8***
store i8** getelementptr inbounds ([3 x i8*]* @GV2, i64 1, i64 0), i8*** %3
ret void
}

View File

@ -1,59 +0,0 @@
; RUN: opt -S -globalopt < %s | FileCheck %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-apple-darwin10.0.0"
%0 = type { i8*, i8* }
%1 = type { i8*, i8*, i32, i32, i8*, i64 }
%2 = type { i32, void ()* }
%struct.A = type { i32 }
%struct.B = type { i32 (...)**, i8*, [4 x i8] }
@y = global i8 0, align 1
@x = global %struct.B zeroinitializer, align 8
@_ZTV1B = weak_odr unnamed_addr constant [3 x i8*] [i8* inttoptr (i64 16 to i8*), i8* null, i8* bitcast (%1* @_ZTI1B to i8*)]
@_ZTVN10__cxxabiv121__vmi_class_type_infoE = external global i8*
@_ZTS1B = weak_odr constant [3 x i8] c"1B\00"
@_ZTVN10__cxxabiv117__class_type_infoE = external global i8*
@_ZTS1A = weak_odr constant [3 x i8] c"1A\00"
@_ZTI1A = weak_odr unnamed_addr constant %0 { i8* bitcast (i8** getelementptr inbounds (i8** @_ZTVN10__cxxabiv117__class_type_infoE, i64 2) to i8*), i8* getelementptr inbounds ([3 x i8]* @_ZTS1A, i32 0, i32 0) }
@_ZTI1B = weak_odr unnamed_addr constant %1 { i8* bitcast (i8** getelementptr inbounds (i8** @_ZTVN10__cxxabiv121__vmi_class_type_infoE, i64 2) to i8*), i8* getelementptr inbounds ([3 x i8]* @_ZTS1B, i32 0, i32 0), i32 0, i32 1, i8* bitcast (%0* @_ZTI1A to i8*), i64 -6141 }
@_ZTT1B = weak_odr unnamed_addr constant [1 x i8*] [i8* bitcast (i8** getelementptr inbounds ([3 x i8*]* @_ZTV1B, i64 1, i64 0) to i8*)]
@llvm.global_ctors = appending global [1 x %2] [%2 { i32 65535, void ()* @_GLOBAL__I_a }]
; CHECK-NOT: __cxx_global_var_init
define internal void @__cxx_global_var_init() section "__TEXT,__StaticInit,regular,pure_instructions" {
entry:
call void @_ZN1BC1Ev(%struct.B* @x)
ret void
}
; CHECK-NOT: _ZN1BC1Ev
define linkonce_odr unnamed_addr void @_ZN1BC1Ev(%struct.B* %this) inlinehint ssp align 2 {
entry:
%0 = bitcast %struct.B* %this to i8*
%1 = getelementptr inbounds i8* %0, i64 16
%2 = bitcast i8* %1 to %struct.A*
call void @_ZN1AC2Ev(%struct.A* %2)
%3 = bitcast %struct.B* %this to i8***
store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1B, i64 1, i64 0), i8*** %3
ret void
}
; CHECK-NOT: _ZN1AC2Ev
define linkonce_odr unnamed_addr void @_ZN1AC2Ev(%struct.A* %this) nounwind ssp align 2 {
entry:
%0 = ptrtoint %struct.A* %this to i64
%sub = sub i64 %0, ptrtoint (%struct.B* @x to i64)
%div = udiv i64 %sub, 8
%conv = trunc i64 %div to i8
store i8 %conv, i8* @y, align 1
ret void
}
; CHECK-NOT: _GLOBAL__I_a
define internal void @_GLOBAL__I_a() section "__TEXT,__StaticInit,regular,pure_instructions" {
entry:
call void @__cxx_global_var_init()
ret void
}