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: call void @llvm.memset.p0.i64(ptr @g.body, i8 0, i64 4, i1 false)
10 ; CHECK-NEXT: store i16 -1, ptr @g.body, align 2
11 ; CHECK-NEXT: ret i32 0
14 %call = call ptr @calloc(i64 1, i64 4)
15 store ptr %call, ptr @g, align 8
16 store i16 -1, ptr %call
20 define signext i32 @main() {
23 ; CHECK-NEXT: [[CALL:%.*]] = call signext i32 @f()
24 ; CHECK-NEXT: call void @f1()
25 ; CHECK-NEXT: store i32 1, ptr @g.body, align 4
26 ; CHECK-NEXT: call void @f1()
27 ; CHECK-NEXT: store i8 2, ptr @g.body, align 4
28 ; CHECK-NEXT: call void @f1()
29 ; CHECK-NEXT: [[RES:%.*]] = load i32, ptr @g.body, align 4
30 ; CHECK-NEXT: ret i32 [[RES]]
33 %call = call signext i32 @f()
35 %v0 = load ptr, ptr @g, align 8
36 store i32 1, ptr %v0, align 4
38 %v1 = load ptr, ptr @g, align 8
39 store i8 2, ptr %v1, align 4
41 %v2 = load ptr, ptr @g, align 8
42 %res = load i32, ptr %v2, align 4
46 declare noalias align 16 ptr @calloc(i64, i64) allockind("alloc,zeroed") allocsize(0,1)