Skip to content

Commit

Permalink
Fix insert_node_here! if called at the end of the IR (JuliaLang#39021)
Browse files Browse the repository at this point in the history
This method was throwing an error when called after the compaction
had processes the last instruction in the IR (with reverse affinity).
This currently can't, because we never use this method after compacting
a terminal instruction (inlining uses it to split BBs), but can after
the new code in JuliaLang#37849, so fix the bug now. Forward port from JuliaLang#37849.
  • Loading branch information
Keno authored and ElOceanografo committed May 4, 2021
1 parent 2feaee6 commit 342b20c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion base/compiler/ssair/ir.jl
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,9 @@ end
function insert_node_here!(compact::IncrementalCompact, @nospecialize(val), @nospecialize(typ), ltable_idx::Int32, reverse_affinity::Bool=false)
refinish = false
result_idx = compact.result_idx
if result_idx == first(compact.result_bbs[compact.active_result_bb].stmts) && reverse_affinity
if reverse_affinity &&
((compact.active_result_bb == length(compact.result_bbs) + 1) ||
result_idx == first(compact.result_bbs[compact.active_result_bb].stmts))
compact.active_result_bb -= 1
refinish = true
end
Expand Down

0 comments on commit 342b20c

Please sign in to comment.