1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=globalopt -S < %s | FileCheck %s
4 @g = internal global ptr null, align 8
6 define signext i32 @f() local_unnamed_addr {
9 ; CHECK-NEXT: store i16 -1, ptr @g.body, align 2
10 ; CHECK-NEXT: ret i32 0
13 %call = call ptr @malloc(i64 4)
14 store ptr %call, ptr @g, align 8
15 store i16 -1, ptr %call
19 define signext i32 @main() {
22 ; CHECK-NEXT: [[CALL:%.*]] = call signext i32 @f()
23 ; CHECK-NEXT: call void @f1()
24 ; CHECK-NEXT: store i32 1, ptr @g.body, align 4
25 ; CHECK-NEXT: call void @f1()
26 ; CHECK-NEXT: store i8 2, ptr @g.body, align 4
27 ; CHECK-NEXT: call void @f1()
28 ; CHECK-NEXT: [[RES:%.*]] = load i32, ptr @g.body, align 4
29 ; CHECK-NEXT: ret i32 [[RES]]
32 %call = call signext i32 @f()
34 %v0 = load ptr, ptr @g, align 8
35 store i32 1, ptr %v0, align 4
37 %v1 = load ptr, ptr @g, align 8
38 store i8 2, ptr %v1, align 4
40 %v2 = load ptr, ptr @g, align 8
41 %res = load i32, ptr %v2, align 4
45 declare noalias align 16 ptr @malloc(i64) allockind("alloc,uninitialized") allocsize(0)