1 ; RUN: opt -globalopt -S -o - < %s | FileCheck %s 2 3 @glbl = internal global i8* null 4 5 define void @test1a() { 6 ; CHECK-LABEL: @test1a( 7 ; CHECK-NOT: store 8 ; CHECK-NEXT: ret void 9 store i8* null, i8** @glbl 10 ret void 11 } 12 13 define void @test1b(i8* %p) { 14 ; CHECK-LABEL: @test1b( 15 ; CHECK-NEXT: store 16 ; CHECK-NEXT: ret void 17 store i8* %p, i8** @glbl 18 ret void 19 } 20 21 define void @test2() { 22 ; CHECK-LABEL: @test2( 23 ; CHECK: alloca i8 24 %txt = alloca i8 25 call void @foo2(i8* %txt) 26 %call2 = call i8* @strdup(i8* %txt) 27 store i8* %call2, i8** @glbl 28 ret void 29 } 30 declare i8* @strdup(i8*) 31 declare void @foo2(i8*) 32 33 define void @test3() uwtable { 34 ; CHECK-LABEL: @test3( 35 ; CHECK-NOT: bb1: 36 ; CHECK-NOT: bb2: 37 ; CHECK: invoke 38 %ptr = invoke i8* @_Znwm(i64 1) 39 to label %bb1 unwind label %bb2 40 bb1: 41 store i8* %ptr, i8** @glbl 42 unreachable 43 bb2: 44 %tmp1 = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 45 cleanup 46 resume { i8*, i32 } %tmp1 47 } 48 declare i32 @__gxx_personality_v0(i32, i64, i8*, i8*) 49 declare i8* @_Znwm(i64) 50