1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -globalopt -S < %s | FileCheck %s
3 ; RUN: opt -passes=globalopt -S < %s | FileCheck %s
5 @g = internal global i32* null, align 8
7 define signext i32 @f() local_unnamed_addr {
10 ; CHECK-NEXT: call void @f1()
11 ; CHECK-NEXT: store i32 1, i32* @g.body, align 4
12 ; CHECK-NEXT: call void @f1()
13 ; CHECK-NEXT: store i8 2, i8* bitcast (i32* @g.body to i8*), align 4
14 ; CHECK-NEXT: ret i32 1
17 %call = call i8* @malloc(i64 4)
18 %b = bitcast i8* %call to i32*
19 store i32* %b, i32** @g, align 8
21 %0 = load i32*, i32** @g, align 8
22 store i32 1, i32* %0, align 4
24 %1 = load i8*, i8** bitcast (i32** @g to i8**), align 8
25 store i8 2, i8* %1, align 4
29 define signext i32 @main() {
32 ; CHECK-NEXT: [[CALL:%.*]] = call signext i32 @f()
33 ; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @g.body, align 4
34 ; CHECK-NEXT: ret i32 [[TMP0]]
37 %call = call signext i32 @f()
38 %0 = load i32*, i32** @g, align 8
39 %1 = load i32, i32* %0, align 4
43 declare noalias align 16 i8* @malloc(i64)