• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -globalopt -S -o - < %s | FileCheck %s
2
3@glbl = internal global i8* null
4
5define 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
13define 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
21define 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}
30declare i8* @strdup(i8*)
31declare void @foo2(i8*)
32
33define void @test3() uwtable personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 {
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
40bb1:
41  store i8* %ptr, i8** @glbl
42  unreachable
43bb2:
44  %tmp1 = landingpad { i8*, i32 }
45          cleanup
46  resume { i8*, i32 } %tmp1
47}
48declare i32 @__gxx_personality_v0(i32, i64, i8*, i8*)
49declare i8* @_Znwm(i64)
50