50 lines · plain
1; RUN: opt -passes=globalopt -S -o - < %s | FileCheck %s2 3@glbl = internal global ptr null4 5define void @test1a() {6; CHECK-LABEL: @test1a(7; CHECK-NOT: store8; CHECK-NEXT: ret void9 store ptr null, ptr @glbl10 ret void11}12 13define void @test1b(ptr %p) {14; CHECK-LABEL: @test1b(15; CHECK-NEXT: store16; CHECK-NEXT: ret void17 store ptr %p, ptr @glbl18 ret void19}20 21define void @test2() {22; CHECK-LABEL: @test2(23; CHECK: alloca i824 %txt = alloca i825 call void @foo2(ptr %txt)26 %call2 = call ptr @strdup(ptr %txt)27 store ptr %call2, ptr @glbl28 ret void29}30declare ptr @strdup(ptr)31declare void @foo2(ptr)32 33define void @test3() uwtable personality ptr @__gxx_personality_v0 {34; CHECK-LABEL: @test3(35; CHECK-NOT: bb1:36; CHECK-NOT: bb2:37; CHECK: invoke38 %ptr = invoke ptr @_Znwm(i64 1)39 to label %bb1 unwind label %bb240bb1:41 store ptr %ptr, ptr @glbl42 unreachable43bb2:44 %tmp1 = landingpad { ptr, i32 }45 cleanup46 resume { ptr, i32 } %tmp147}48declare i32 @__gxx_personality_v0(i32, i64, ptr, ptr)49declare ptr @_Znwm(i64)50