File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -2336,9 +2336,9 @@ function cfg_simplify!(ir::IRCode)
2336
2336
end
2337
2337
elseif new_edge == - 1
2338
2338
@assert length (phi. edges) == 1
2339
- if isassigned (phi . values , old_index)
2339
+ if isassigned (renamed_values , old_index)
2340
2340
push! (edges, - 1 )
2341
- push! (values, phi . values [old_index])
2341
+ push! (values, renamed_values [old_index])
2342
2342
end
2343
2343
elseif new_edge == - 3
2344
2344
# Multiple predecessors, we need to expand out this phi
Original file line number Diff line number Diff line change @@ -1576,17 +1576,21 @@ end
1576
1576
# Test CFG simplify with single predecessor phi node
1577
1577
let code = Any[
1578
1578
# Block 1
1579
- Expr (:call , Base. inferencebarrier, 1 ),
1580
1579
GotoNode (3 ),
1581
1580
# Block 2
1582
- PhiNode (Int32[1 ], Any[SSAValue (1 )]),
1583
- ReturnNode (SSAValue (3 ))
1581
+ nothing ,
1582
+ # Block 3
1583
+ Expr (:call , Base. inferencebarrier, 1 ),
1584
+ GotoNode (5 ),
1585
+ # Block 4
1586
+ PhiNode (Int32[4 ], Any[SSAValue (3 )]),
1587
+ ReturnNode (SSAValue (5 ))
1584
1588
]
1585
1589
ir = make_ircode (code)
1586
1590
ir = Core. Compiler. cfg_simplify! (ir)
1587
1591
Core. Compiler. verify_ir (ir)
1588
- @test length (ir. cfg. blocks) == 1
1592
+ @test length (ir. cfg. blocks) <= 2
1589
1593
ir = Core. Compiler. compact! (ir)
1590
- @test length (ir. stmts) == 2
1591
- @test (ir[SSAValue (2 ) ][:stmt ]:: ReturnNode ). val == SSAValue ( 1 )
1594
+ @test length (ir. stmts) <= 3
1595
+ @test (ir[SSAValue (length (ir . stmts)) ][:stmt ]:: ReturnNode ). val ! == nothing
1592
1596
end
You can’t perform that action at this time.
0 commit comments