Commit e11b31c
committed
post-opt: use augmented post-domtree for
This commit fixes the first problem that was found while digging into
#53613. It turns out that the post-domtree constructed
from regular `IRCode` doesn't work for visiting conditional successors
for post-opt analysis in cases like:
```julia
julia> let code = Any[
# block 1
GotoIfNot(Argument(2), 3),
# block 2
ReturnNode(Argument(3)),
# block 3 (we should visit this block)
Expr(:call, throw, "potential throw"),
ReturnNode(), # unreachable
]
ir = make_ircode(code; slottypes=Any[Any,Bool,Bool])
visited = BitSet()
@test !Core.Compiler.visit_conditional_successors(CC.LazyPostDomtree(ir), ir, #=bb=#1) do succ::Int
push!(visited, succ)
return false
end
@test 2 ∉ visited
@test 3 ∈ visited
end
Test Failed at REPL[14]:16
Expression: 2 ∉ visited
Evaluated: 2 ∉ BitSet([2])
```
This might mean that we need to fix on the `postdominates` end, but for
now, this commit tries to get around it by using the augmented post
domtree in `visit_conditional_successors`, while also enforcing the
augmented control flow graph (`construct_augmented_cfg`) to have a
single exit node really. Since the augmented post domtree is now
enforced to have a single return, we can keep using the current
`postdominates` to fix the issue.
However, this commit isn't enough to fix the NeuralNetworkReachability
segfault as reported in #53613, and we need to tackle the second issue
reported there too (#53613 (comment)).visit_conditional_successors
1 parent 4dcf357 commit e11b31c
3 files changed
+110
-47
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
530 | | - | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
531 | 569 | | |
532 | 570 | | |
533 | 571 | | |
534 | 572 | | |
535 | 573 | | |
536 | 574 | | |
537 | 575 | | |
538 | | - | |
| 576 | + | |
539 | 577 | | |
540 | 578 | | |
541 | 579 | | |
| |||
548 | 586 | | |
549 | 587 | | |
550 | 588 | | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | 589 | | |
579 | 590 | | |
580 | 591 | | |
581 | 592 | | |
582 | 593 | | |
583 | | - | |
584 | | - | |
| 594 | + | |
585 | 595 | | |
586 | 596 | | |
587 | 597 | | |
| |||
592 | 602 | | |
593 | 603 | | |
594 | 604 | | |
595 | | - | |
596 | | - | |
597 | | - | |
| 605 | + | |
| 606 | + | |
598 | 607 | | |
599 | 608 | | |
600 | 609 | | |
| |||
834 | 843 | | |
835 | 844 | | |
836 | 845 | | |
837 | | - | |
| 846 | + | |
838 | 847 | | |
839 | 848 | | |
840 | 849 | | |
841 | 850 | | |
842 | 851 | | |
843 | | - | |
| 852 | + | |
844 | 853 | | |
845 | 854 | | |
846 | 855 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1387 | 1387 | | |
1388 | 1388 | | |
1389 | 1389 | | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
| 236 | + | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
244 | 244 | | |
245 | | - | |
| 245 | + | |
| 246 | + | |
246 | 247 | | |
247 | | - | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
248 | 293 | | |
249 | | - | |
250 | | - | |
| 294 | + | |
| 295 | + | |
251 | 296 | | |
252 | | - | |
| 297 | + | |
253 | 298 | | |
254 | 299 | | |
255 | | - | |
256 | 300 | | |
257 | | - | |
| 301 | + | |
258 | 302 | | |
259 | 303 | | |
260 | 304 | | |
261 | 305 | | |
262 | 306 | | |
263 | | - | |
264 | | - | |
| 307 | + | |
| 308 | + | |
265 | 309 | | |
266 | 310 | | |
267 | 311 | | |
| |||
0 commit comments