1; RUN: opt -licm -disable-output < %s
2
3target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
4target triple = "x86_64-apple-darwin10.0.0"
5
6
7; PR8068
8@g_12 = external global i8, align 1
9define void @test1() nounwind ssp {
10entry:
11  br label %for.body
12
13for.body:                                         ; preds = %for.cond, %bb.nph
14  store i8 0, i8* @g_12, align 1
15  %tmp6 = load i8* @g_12, align 1
16  br label %for.cond
17
18for.cond:                                         ; preds = %for.body
19  store i8 %tmp6, i8* @g_12, align 1
20  br i1 false, label %for.cond.for.end10_crit_edge, label %for.body
21
22for.cond.for.end10_crit_edge:                     ; preds = %for.cond
23  br label %for.end10
24
25for.end10:                                        ; preds = %for.cond.for.end10_crit_edge, %entry
26  ret void
27}
28
29; PR8067
30@g_8 = external global i32, align 4
31
32define void @test2() noreturn nounwind ssp {
33entry:
34  br label %for.body
35
36for.body:                                         ; preds = %for.body, %entry
37  %tmp7 = load i32* @g_8, align 4
38  store i32* @g_8, i32** undef, align 16
39  store i32 undef, i32* @g_8, align 4
40  br label %for.body
41}
42
43; PR8102
44define void @test3() {
45entry:
46  %__first = alloca { i32* }
47  br i1 undef, label %for.cond, label %for.end
48
49for.cond:                                         ; preds = %for.cond, %entry
50  %tmp1 = getelementptr { i32*}* %__first, i32 0, i32 0
51  %tmp2 = load i32** %tmp1, align 4
52  %call = tail call i32* @test3helper(i32* %tmp2)
53  %tmp3 = getelementptr { i32*}* %__first, i32 0, i32 0
54  store i32* %call, i32** %tmp3, align 4
55  br i1 false, label %for.cond, label %for.end
56
57for.end:                                          ; preds = %for.cond, %entry
58  ret void
59}
60
61declare i32* @test3helper(i32*)
62
63
64; PR8602
65@g_47 = external global i32, align 4
66
67define void @test4() noreturn nounwind {
68  br label %1
69
70; <label>:1                                       ; preds = %1, %0
71  store volatile i32* @g_47, i32** undef, align 8
72  store i32 undef, i32* @g_47, align 4
73  br label %1
74}
75