Commit c45b338
authored
[CIR] Fix error in cir.label when using cir.br in entry block (#1939)
This PR fixes an error I found while working on `cir.indirectbr`. The
issue occurs when a branching operator points to the entry block LLVM’s
verifier does not allow this
https://github.com/llvm/clangir/blob/10f2ee11fa61bb1550819ed54a5b0e111d9243aa/mlir/lib/IR/Verifier.cpp#L205-L208
Previously, in `cir.label`, when building a block, we only checked if
the current block was not empty. Now, we also check if we are in the
entry block. If we are, a new block is created instead.
This change also helps emit IR that is closer to the classic code
behavior.1 parent 700e98e commit c45b338
File tree
3 files changed
+33
-14
lines changed- clang
- lib/CIR/CodeGen
- test/CIR/CodeGen
3 files changed
+33
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
643 | 643 | | |
644 | 644 | | |
645 | 645 | | |
646 | | - | |
| 646 | + | |
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
71 | 80 | | |
72 | 81 | | |
73 | 82 | | |
| |||
189 | 198 | | |
190 | 199 | | |
191 | 200 | | |
192 | | - | |
| 201 | + | |
193 | 202 | | |
194 | 203 | | |
195 | 204 | | |
| |||
200 | 209 | | |
201 | 210 | | |
202 | 211 | | |
203 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
204 | 215 | | |
205 | 216 | | |
206 | | - | |
207 | | - | |
208 | 217 | | |
209 | 218 | | |
210 | 219 | | |
| 220 | + | |
| 221 | + | |
211 | 222 | | |
212 | 223 | | |
213 | 224 | | |
| |||
254 | 265 | | |
255 | 266 | | |
256 | 267 | | |
257 | | - | |
| 268 | + | |
258 | 269 | | |
259 | 270 | | |
260 | 271 | | |
261 | 272 | | |
262 | | - | |
| 273 | + | |
263 | 274 | | |
264 | | - | |
| 275 | + | |
265 | 276 | | |
266 | | - | |
| 277 | + | |
267 | 278 | | |
| 279 | + | |
| 280 | + | |
268 | 281 | | |
269 | 282 | | |
270 | | - | |
271 | | - | |
272 | 283 | | |
273 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
274 | 289 | | |
275 | 290 | | |
276 | 291 | | |
| |||
290 | 305 | | |
291 | 306 | | |
292 | 307 | | |
293 | | - | |
294 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
295 | 312 | | |
296 | 313 | | |
297 | 314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | | - | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| |||
0 commit comments