1 ; RUN: opt -globalopt -S < %s | FileCheck %s
2 ; RUN: opt -passes=globalopt -S < %s | FileCheck %s
5 @g = internal global %s* null, align 8
7 ; Test code pattern for:
8 ; class s { int a; s() { a = 1;} };
12 define internal void @f() {
14 ; CHECK-NEXT: ret void
16 %1 = tail call i8* @_Znwm(i64 4)
17 %2 = bitcast i8* %1 to %s*
18 %3 = getelementptr inbounds %s, %s* %2, i64 0, i32 0
19 store i32 1, i32* %3, align 4
20 store i8* %1, i8** bitcast (%s** @g to i8**), align 8
24 define dso_local signext i32 @main() {
27 ; CHECK-NEXT: call fastcc void @f()
28 ; CHECK-NEXT: ret i32 1
32 %0 = load %s*, %s** @g, align 4
33 %1 = getelementptr inbounds %s, %s* %0, i64 0, i32 0
34 %2 = load i32, i32* %1, align 4
38 declare nonnull i8* @_Znwm(i64)
40 declare signext i32 @printf(i8*, ...)