1 # RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 %s -o - \
2 # RUN: -run-pass=livevars,phi-node-elimination | FileCheck %s
5 define void @phi_eliminate(i32 %0, i32 %1, ptr %2) {
6 %scevgep3 = getelementptr i8, ptr %2, i64 undef
7 call void @llvm.set.loop.iterations.i64(i64 undef)
11 %5 = phi i32 [ %8, %4 ], [ %0, %3 ]
12 %6 = phi ptr [ %scevgep3, %3 ], [ %7, %4 ]
13 %7 = getelementptr i8, ptr %6, i64 -1
15 %9 = mul nsw i32 %8, %1
16 %10 = sub nsw i32 %5, %9
17 %11 = icmp ult i32 %10, 10
18 %12 = trunc i32 %10 to i8
19 %13 = select i1 %11, i8 48, i8 55
21 store i8 %14, ptr %7, align 1
22 %15 = call i1 @llvm.loop.decrement.i64(i64 1)
23 br i1 %15, label %4, label %16
29 declare void @llvm.set.loop.iterations.i64(i64)
31 declare i1 @llvm.loop.decrement.i64(i64)
33 declare void @llvm.stackprotector(ptr, ptr)
38 exposesReturnsTwice: false
40 regBankSelected: false
43 tracksRegLiveness: true
46 - { id: 0, class: g8rc_and_g8rc_nox0, preferred-register: '' }
47 - { id: 1, class: gprc, preferred-register: '' }
48 - { id: 2, class: g8rc_and_g8rc_nox0, preferred-register: '' }
49 - { id: 3, class: g8rc, preferred-register: '' }
50 - { id: 4, class: gprc, preferred-register: '' }
51 - { id: 5, class: g8rc, preferred-register: '' }
52 - { id: 6, class: g8rc, preferred-register: '' }
53 - { id: 7, class: g8rc, preferred-register: '' }
54 - { id: 8, class: gprc, preferred-register: '' }
55 - { id: 9, class: gprc, preferred-register: '' }
56 - { id: 10, class: g8rc, preferred-register: '' }
57 - { id: 11, class: gprc, preferred-register: '' }
58 - { id: 12, class: gprc, preferred-register: '' }
59 - { id: 13, class: crrc, preferred-register: '' }
60 - { id: 14, class: gprc_and_gprc_nor0, preferred-register: '' }
61 - { id: 15, class: gprc_and_gprc_nor0, preferred-register: '' }
62 - { id: 16, class: gprc, preferred-register: '' }
63 - { id: 17, class: gprc, preferred-register: '' }
64 - { id: 18, class: g8rc_and_g8rc_nox0, preferred-register: '' }
65 - { id: 19, class: gprc, preferred-register: '' }
66 - { id: 20, class: gprc, preferred-register: '' }
67 - { id: 21, class: gprc, preferred-register: '' }
68 - { id: 22, class: crrc, preferred-register: '' }
69 - { id: 23, class: gprc, preferred-register: '' }
70 - { id: 24, class: gprc, preferred-register: '' }
71 - { id: 25, class: g8rc_and_g8rc_nox0, preferred-register: '' }
72 - { id: 26, class: gprc, preferred-register: '' }
73 - { id: 27, class: g8rc_and_g8rc_nox0, preferred-register: '' }
74 - { id: 28, class: gprc, preferred-register: '' }
75 - { id: 29, class: gprc, preferred-register: '' }
76 - { id: 30, class: gprc, preferred-register: '' }
77 - { id: 31, class: crrc, preferred-register: '' }
78 - { id: 32, class: gprc, preferred-register: '' }
79 - { id: 33, class: gprc, preferred-register: '' }
80 - { id: 34, class: g8rc_and_g8rc_nox0, preferred-register: '' }
81 - { id: 35, class: gprc, preferred-register: '' }
82 - { id: 36, class: gprc, preferred-register: '' }
83 - { id: 37, class: gprc, preferred-register: '' }
84 - { id: 38, class: g8rc_and_g8rc_nox0, preferred-register: '' }
85 - { id: 39, class: g8rc, preferred-register: '' }
86 - { id: 40, class: gprc, preferred-register: '' }
87 - { id: 41, class: gprc, preferred-register: '' }
88 - { id: 42, class: g8rc_and_g8rc_nox0, preferred-register: '' }
89 - { id: 43, class: gprc, preferred-register: '' }
90 - { id: 44, class: g8rc_and_g8rc_nox0, preferred-register: '' }
91 - { id: 45, class: gprc, preferred-register: '' }
92 - { id: 46, class: gprc, preferred-register: '' }
93 - { id: 47, class: crrc, preferred-register: '' }
94 - { id: 48, class: gprc, preferred-register: '' }
95 - { id: 49, class: gprc, preferred-register: '' }
96 - { id: 50, class: g8rc_and_g8rc_nox0, preferred-register: '' }
97 - { id: 51, class: g8rc, preferred-register: '' }
98 - { id: 52, class: gprc, preferred-register: '' }
99 - { id: 53, class: gprc, preferred-register: '' }
100 - { id: 54, class: g8rc_and_g8rc_nox0, preferred-register: '' }
101 - { id: 55, class: gprc, preferred-register: '' }
102 - { id: 56, class: gprc, preferred-register: '' }
104 - { reg: '$x3', virtual-reg: '%5' }
105 - { reg: '$x4', virtual-reg: '%6' }
107 isFrameAddressTaken: false
108 isReturnAddressTaken: false
117 maxCallFrameSize: 4294967295
118 cvBytesOfCalleeSavedRegisters: 0
119 hasOpaqueSPAdjustment: false
121 hasMustTailInVarArgFunc: false
129 machineFunctionInfo: {}
131 ; CHECK-LABEL: name: phi_eliminate
132 ; CHECK: bb.0 (%ir-block.3):
133 ; CHECK: successors: %bb.1(0x80000000)
134 ; CHECK: liveins: $x3, $x4
135 ; CHECK: %6:g8rc = COPY killed $x4
136 ; CHECK: %5:g8rc = COPY killed $x3
137 ; CHECK: %9:gprc = COPY killed %6.sub_32
138 ; CHECK: %8:gprc = COPY killed %5.sub_32
139 ; CHECK: MTCTR8loop undef %10:g8rc, implicit-def dead $ctr8
140 ; CHECK: %14:gprc_and_gprc_nor0 = LI 55
141 ; CHECK: %15:gprc_and_gprc_nor0 = LI 48
143 ; CHECK: bb.1 (%ir-block.4):
144 ; CHECK: successors: %bb.2(0x40000000), %bb.7(0x40000000)
145 ; CHECK: %19:gprc = DIVW %8, %9
146 ; CHECK: BDNZ8 %bb.2, implicit-def $ctr8, implicit $ctr8
149 ; CHECK: successors: %bb.5(0x80000000)
150 ; CHECK: %61:gprc = COPY killed %8
151 ; CHECK: %62:g8rc_and_g8rc_nox0 = IMPLICIT_DEF
152 ; CHECK: %63:gprc = COPY killed %19
155 ; CHECK: bb.2 (%ir-block.4):
156 ; CHECK: successors: %bb.3(0x40000000), %bb.4(0x40000000)
157 ; CHECK: %20:gprc = nsw MULLW %19, %9
158 ; CHECK: %21:gprc = SUBF killed %20, killed %8
159 ; CHECK: %22:crrc = CMPLWI %21, 10
160 ; CHECK: %23:gprc = ISEL %15, %14, killed %22.sub_lt
161 ; CHECK: %24:gprc = ADD4 killed %23, killed %21
162 ; CHECK: %25:g8rc_and_g8rc_nox0 = STBU killed %24, -1, undef %0:g8rc_and_g8rc_nox0 :: (store (s8) into %ir.7)
163 ; CHECK: %26:gprc = DIVW %19, %9
164 ; CHECK: %57:gprc = COPY killed %26
165 ; CHECK: %58:gprc = COPY %19
166 ; CHECK: %59:g8rc_and_g8rc_nox0 = COPY killed %25
167 ; CHECK: %60:gprc = COPY killed %19
168 ; CHECK: BDZ8 %bb.4, implicit-def $ctr8, implicit $ctr8
171 ; CHECK: bb.3 (%ir-block.4):
172 ; CHECK: successors: %bb.3(0x7c000000), %bb.4(0x04000000)
173 ; CHECK: %38:g8rc_and_g8rc_nox0 = COPY killed %59
174 ; CHECK: %37:gprc = COPY %57
175 ; CHECK: %36:gprc = COPY killed %58
176 ; CHECK: %35:gprc = COPY killed %57
177 ; CHECK: %27:g8rc_and_g8rc_nox0 = COPY killed %38
178 ; CHECK: %56:gprc = COPY %35
179 ; CHECK: %28:gprc = DIVW %56, %9
180 ; CHECK: %29:gprc = nsw MULLW killed %37, %9
181 ; CHECK: %30:gprc = SUBF killed %29, killed %36
182 ; CHECK: %31:crrc = CMPLWI %30, 10
183 ; CHECK: %32:gprc = ISEL %15, %14, killed %31.sub_lt
184 ; CHECK: %33:gprc = ADD4 killed %32, killed %30
185 ; CHECK: %34:g8rc_and_g8rc_nox0 = STBU killed %33, -1, killed %27 :: (store unknown-size into %ir.7, align 1)
186 ; CHECK: %57:gprc = COPY killed %28
187 ; CHECK: %58:gprc = COPY killed %35
188 ; CHECK: %59:g8rc_and_g8rc_nox0 = COPY killed %34
189 ; CHECK: %60:gprc = COPY killed %56
190 ; CHECK: BDNZ8 %bb.3, implicit-def $ctr8, implicit $ctr8
194 ; CHECK: successors: %bb.5(0x80000000)
195 ; CHECK: %44:g8rc_and_g8rc_nox0 = COPY killed %59
196 ; CHECK: %43:gprc = COPY killed %57
197 ; CHECK: %41:gprc = COPY killed %60
198 ; CHECK: %39:g8rc = COPY killed %44
199 ; CHECK: %61:gprc = COPY killed %41
200 ; CHECK: %62:g8rc_and_g8rc_nox0 = COPY killed %39
201 ; CHECK: %63:gprc = COPY killed %43
204 ; CHECK: successors: %bb.6(0x80000000)
205 ; CHECK: %55:gprc = COPY killed %63
206 ; CHECK: %54:g8rc_and_g8rc_nox0 = COPY killed %62
207 ; CHECK: %53:gprc = COPY killed %61
208 ; CHECK: %45:gprc = nsw MULLW killed %55, killed %9
209 ; CHECK: %46:gprc = SUBF killed %45, killed %53
210 ; CHECK: %47:crrc = CMPLWI %46, 10
211 ; CHECK: %48:gprc = ISEL killed %15, killed %14, killed %47.sub_lt
212 ; CHECK: %49:gprc = ADD4 killed %48, killed %46
213 ; CHECK: dead %50:g8rc_and_g8rc_nox0 = STBU killed %49, -1, killed %54 :: (store unknown-size into %ir.7, align 1)
216 ; CHECK: bb.6 (%ir-block.16):
217 ; CHECK: BLR8 implicit $lr8, implicit $rm
220 successors: %bb.1(0x80000000)
223 %6:g8rc = COPY killed $x4
224 %5:g8rc = COPY killed $x3
225 %9:gprc = COPY killed %6.sub_32
226 %8:gprc = COPY killed %5.sub_32
227 MTCTR8loop undef %10:g8rc, implicit-def dead $ctr8
228 %14:gprc_and_gprc_nor0 = LI 55
229 %15:gprc_and_gprc_nor0 = LI 48
232 successors: %bb.2(0x40000000), %bb.5(0x40000000)
234 %19:gprc = DIVW %8, %9
235 BDZ8 %bb.5, implicit-def $ctr8, implicit $ctr8
239 successors: %bb.3(0x40000000), %bb.4(0x40000000)
241 %20:gprc = nsw MULLW %19, %9
242 %21:gprc = SUBF killed %20, killed %8
243 %22:crrc = CMPLWI %21, 10
244 %23:gprc = ISEL %15, %14, killed %22.sub_lt
245 %24:gprc = ADD4 killed %23, killed %21
246 %25:g8rc_and_g8rc_nox0 = STBU killed %24, -1, undef %0:g8rc_and_g8rc_nox0 :: (store (s8) into %ir.7)
247 %26:gprc = DIVW %19, %9
248 BDZ8 %bb.4, implicit-def $ctr8, implicit $ctr8
252 successors: %bb.3(0x7c000000), %bb.4(0x04000000)
254 %35:gprc = PHI %26, %bb.2, %28, %bb.3
255 %36:gprc = PHI %19, %bb.2, %35, %bb.3
256 %37:gprc = PHI %26, %bb.2, %28, %bb.3
257 %38:g8rc_and_g8rc_nox0 = PHI %25, %bb.2, %34, %bb.3
258 %27:g8rc_and_g8rc_nox0 = COPY killed %38
260 %28:gprc = DIVW %56, %9
261 %29:gprc = nsw MULLW killed %37, %9
262 %30:gprc = SUBF killed %29, killed %36
263 %31:crrc = CMPLWI %30, 10
264 %32:gprc = ISEL %15, %14, killed %31.sub_lt
265 %33:gprc = ADD4 killed %32, killed %30
266 %34:g8rc_and_g8rc_nox0 = STBU killed %33, -1, killed %27 :: (store unknown-size into %ir.7, align 1)
267 BDNZ8 %bb.3, implicit-def $ctr8, implicit $ctr8
271 successors: %bb.5(0x80000000)
273 %41:gprc = PHI %19, %bb.2, %56, %bb.3
274 %43:gprc = PHI %26, %bb.2, %28, %bb.3
275 %44:g8rc_and_g8rc_nox0 = PHI %25, %bb.2, %34, %bb.3
276 %39:g8rc = COPY killed %44
279 successors: %bb.6(0x80000000)
281 %53:gprc = PHI %8, %bb.1, %41, %bb.4
282 %54:g8rc_and_g8rc_nox0 = PHI undef %0:g8rc_and_g8rc_nox0, %bb.1, %39, %bb.4
283 %55:gprc = PHI %19, %bb.1, %43, %bb.4
284 %45:gprc = nsw MULLW killed %55, killed %9
285 %46:gprc = SUBF killed %45, killed %53
286 %47:crrc = CMPLWI %46, 10
287 %48:gprc = ISEL killed %15, killed %14, killed %47.sub_lt
288 %49:gprc = ADD4 killed %48, killed %46
289 dead %50:g8rc_and_g8rc_nox0 = STBU killed %49, -1, killed %54 :: (store unknown-size into %ir.7, align 1)
293 BLR8 implicit $lr8, implicit $rm