1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
;; Ensure we don't change after value numbering by accidentally deleting the wrong expression.
; RUN: opt -newgvn -S %s | FileCheck %s
define void @fn1() local_unnamed_addr #0 {
; CHECK-LABEL: @fn1(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[FOR_COND_PREHEADER:%.*]]
; CHECK: while.cond:
; CHECK-NEXT: br label [[FOR_COND_PREHEADER]]
; CHECK: for.cond.preheader:
; CHECK-NEXT: [[H_031:%.*]] = phi i32 [ 5, [[ENTRY:%.*]] ], [ [[H_127:%.*]], [[WHILE_COND:%.*]] ]
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
; CHECK: for.body:
; CHECK-NEXT: [[H_128:%.*]] = phi i32 [ [[H_031]], [[FOR_COND_PREHEADER]] ], [ [[H_2:%.*]], [[FOR_INC:%.*]] ]
; CHECK-NEXT: br label [[IF_THEN:%.*]]
; CHECK: if.then:
; CHECK-NEXT: br i1 false, label [[L_LOOPEXIT:%.*]], label [[IF_END:%.*]]
; CHECK: if.end:
; CHECK-NEXT: br i1 undef, label [[FOR_INC]], label [[IF_END9:%.*]]
; CHECK: if.end9:
; CHECK-NEXT: br label [[FOR_INC]]
; CHECK: for.inc:
; CHECK-NEXT: [[H_2]] = phi i32 [ [[H_128]], [[IF_END]] ], [ 0, [[IF_END9]] ]
; CHECK-NEXT: br i1 undef, label [[WHILE_COND10_LOOPEXIT:%.*]], label [[FOR_BODY]]
; CHECK: while.cond10.loopexit:
; CHECK-NEXT: br label [[WHILE_COND10:%.*]]
; CHECK: while.cond10:
; CHECK-NEXT: [[H_127]] = phi i32 [ [[H_126:%.*]], [[IF_END18:%.*]] ], [ [[H_125:%.*]], [[L:%.*]] ], [ [[H_2]], [[WHILE_COND10_LOOPEXIT]] ]
; CHECK-NEXT: br i1 undef, label [[WHILE_COND]], label [[WHILE_BODY12:%.*]]
; CHECK: while.body12:
; CHECK-NEXT: br i1 undef, label [[IF_END18]], label [[L]]
; CHECK: L.loopexit:
; CHECK-NEXT: store i8 undef, i8* null
; CHECK-NEXT: br label [[L]]
; CHECK: L:
; CHECK-NEXT: [[H_125]] = phi i32 [ [[H_127]], [[WHILE_BODY12]] ], [ undef, [[L_LOOPEXIT]] ]
; CHECK-NEXT: br i1 undef, label [[WHILE_COND10]], label [[IF_END18]]
; CHECK: if.end18:
; CHECK-NEXT: [[H_126]] = phi i32 [ [[H_125]], [[L]] ], [ [[H_127]], [[WHILE_BODY12]] ]
; CHECK-NEXT: br label [[WHILE_COND10]]
;
entry:
br label %for.cond.preheader
while.cond: ; preds = %while.cond10
br label %for.cond.preheader
for.cond.preheader: ; preds = %while.cond, %entry
%h.031 = phi i32 [ 5, %entry ], [ %h.127, %while.cond ]
br label %for.body
for.body: ; preds = %for.inc, %for.cond.preheader
%h.128 = phi i32 [ %h.031, %for.cond.preheader ], [ %h.2, %for.inc ]
br label %if.then
if.then: ; preds = %for.body
br i1 false, label %L.loopexit, label %if.end
if.end: ; preds = %if.then
br i1 undef, label %for.inc, label %if.end9
if.end9: ; preds = %if.end
br label %for.inc
for.inc: ; preds = %if.end9, %if.end
%h.2 = phi i32 [ %h.128, %if.end ], [ 0, %if.end9 ]
br i1 undef, label %while.cond10.loopexit, label %for.body
while.cond10.loopexit: ; preds = %for.inc
%h.2.lcssa = phi i32 [ %h.2, %for.inc ]
br label %while.cond10
while.cond10: ; preds = %if.end18, %L, %while.cond10.loopexit
%h.127 = phi i32 [ %h.126, %if.end18 ], [ %h.125, %L ], [ %h.2.lcssa, %while.cond10.loopexit ]
br i1 undef, label %while.cond, label %while.body12
while.body12: ; preds = %while.cond10
br i1 undef, label %if.end18, label %L
L.loopexit: ; preds = %if.then
br label %L
L: ; preds = %L.loopexit, %while.body12
%h.125 = phi i32 [ %h.127, %while.body12 ], [ undef, %L.loopexit ]
br i1 undef, label %while.cond10, label %if.end18
if.end18: ; preds = %L, %while.body12
%h.126 = phi i32 [ %h.125, %L ], [ %h.127, %while.body12 ]
br label %while.cond10
}
define void @hoge() local_unnamed_addr #0 {
; CHECK-LABEL: @hoge(
; CHECK-NEXT: bb:
; CHECK-NEXT: br label [[BB1:%.*]]
; CHECK: bb1:
; CHECK-NEXT: [[TMP:%.*]] = phi i64 [ 0, [[BB:%.*]] ], [ [[TMP2:%.*]], [[BB1]] ]
; CHECK-NEXT: [[TMP2]] = add nuw nsw i64 [[TMP]], 1
; CHECK-NEXT: br label [[BB1]]
;
bb:
br label %bb1
bb1: ; preds = %bb1, %bb
%tmp = phi i64 [ 0, %bb ], [ %tmp2, %bb1 ]
%tmp2 = add nuw nsw i64 %tmp, 1
br label %bb1
}
attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
source_filename = "pr33187-c.ll"
define void @a() {
; CHECK-LABEL: @a(
; CHECK-NEXT: b:
; CHECK-NEXT: store i8* null, i8** null
; CHECK-NEXT: br label [[D:%.*]]
; CHECK: d:
; CHECK-NEXT: [[I:%.*]] = phi i8* [ null, [[B:%.*]] ], [ [[E:%.*]], [[F:%.*]] ]
; CHECK-NEXT: br i1 undef, label [[F]], label [[G:%.*]]
; CHECK: g:
; CHECK-NEXT: store i8* [[I]], i8** null
; CHECK-NEXT: unreachable
; CHECK: f:
; CHECK-NEXT: [[E]] = getelementptr i8, i8* [[I]], i64 1
; CHECK-NEXT: br label [[D]]
;
b:
store i8* null, i8** null
br label %d
d: ; preds = %f, %b
%i = phi i8* [ null, %b ], [ %e, %f ]
br i1 undef, label %f, label %g
g: ; preds = %d
%h = phi i8* [ %i, %d ]
store i8* %h, i8** null
unreachable
f: ; preds = %d
%e = getelementptr i8, i8* %i, i64 1
br label %d
}
|