1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
2 ; RUN: opt -S -passes=globalopt -o - < %s | FileCheck %s
4 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 @_ZL3g_i = internal global ptr null, align 8
8 @.str = private unnamed_addr constant [2 x i8] c"0\00", align 1
9 @.str.1 = private unnamed_addr constant [2 x i8] c"1\00", align 1
11 define dso_local i32 @main() {
12 ; CHECK-LABEL: define {{[^@]+}}@main() local_unnamed_addr {
14 ; CHECK-NEXT: store ptr null, ptr @_ZL3g_i, align 8
15 ; CHECK-NEXT: call fastcc void @_ZL13PutsSomethingv()
16 ; CHECK-NEXT: ret i32 0
19 store ptr null, ptr @_ZL3g_i, align 8
20 call void @_ZL13PutsSomethingv()
24 define internal void @_ZL13PutsSomethingv() {
25 ; CHECK-LABEL: define {{[^@]+}}@_ZL13PutsSomethingv() unnamed_addr {
27 ; CHECK-NEXT: [[I:%.*]] = load ptr, ptr @_ZL3g_i, align 8
28 ; CHECK-NEXT: [[I1:%.*]] = icmp eq ptr [[I]], null
29 ; CHECK-NEXT: br i1 [[I1]], label [[BB2:%.*]], label [[BB6:%.*]]
31 ; CHECK-NEXT: [[I3:%.*]] = call noalias ptr @malloc(i64 4)
32 ; CHECK-NEXT: store ptr [[I3]], ptr @_ZL3g_i, align 8
33 ; CHECK-NEXT: [[I5:%.*]] = call i32 @puts(ptr @.str)
34 ; CHECK-NEXT: br label [[BB8:%.*]]
36 ; CHECK-NEXT: [[I7:%.*]] = call i32 @puts(ptr @.str.1)
37 ; CHECK-NEXT: br label [[BB8]]
39 ; CHECK-NEXT: ret void
42 %i = load ptr, ptr @_ZL3g_i, align 8
43 %i1 = icmp eq ptr %i, null
44 br i1 %i1, label %bb2, label %bb6
47 %i3 = call noalias ptr @malloc(i64 4)
48 store ptr %i3, ptr @_ZL3g_i, align 8
49 %i5 = call i32 @puts(ptr @.str)
53 %i7 = call i32 @puts(ptr @.str.1)
56 bb8: ; preds = %bb6, %bb2
60 ; Function Attrs: allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
61 declare dso_local noalias ptr @malloc(i64) #0
63 declare dso_local i32 @puts(ptr nocapture readonly)