Skip to content

Commit 8b93bae

Browse files
committed
Fix oracle check failure in IncrementalCompact
We weren't accounting for the removed use when inlining a constant argtype into a GotoIfNot node.
1 parent 9d5387e commit 8b93bae

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

base/compiler/ssair/ir.jl

+6-5
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ function getindex(view::TypesView, v::OldSSAValue)
918918
return view.ir.pending_nodes.stmts[id][:type]
919919
end
920920

921-
function kill_current_use(compact::IncrementalCompact, @nospecialize(val))
921+
function kill_current_use!(compact::IncrementalCompact, @nospecialize(val))
922922
if isa(val, SSAValue)
923923
@assert compact.used_ssas[val.id] >= 1
924924
compact.used_ssas[val.id] -= 1
@@ -929,17 +929,17 @@ function kill_current_use(compact::IncrementalCompact, @nospecialize(val))
929929
end
930930
end
931931

932-
function kill_current_uses(compact::IncrementalCompact, @nospecialize(stmt))
932+
function kill_current_uses!(compact::IncrementalCompact, @nospecialize(stmt))
933933
for ops in userefs(stmt)
934-
kill_current_use(compact, ops[])
934+
kill_current_use!(compact, ops[])
935935
end
936936
end
937937

938938
function setindex!(compact::IncrementalCompact, @nospecialize(v), idx::SSAValue)
939939
@assert idx.id < compact.result_idx
940940
(compact.result[idx.id][:inst] === v) && return
941941
# Kill count for current uses
942-
kill_current_uses(compact, compact.result[idx.id][:inst])
942+
kill_current_uses!(compact, compact.result[idx.id][:inst])
943943
compact.result[idx.id][:inst] = v
944944
# Add count for new use
945945
count_added_node!(compact, v) && push!(compact.late_fixup, idx.id)
@@ -951,7 +951,7 @@ function setindex!(compact::IncrementalCompact, @nospecialize(v), idx::OldSSAVal
951951
if id < compact.idx
952952
new_idx = compact.ssa_rename[id]
953953
(compact.result[new_idx][:inst] === v) && return
954-
kill_current_uses(compact, compact.result[new_idx][:inst])
954+
kill_current_uses!(compact, compact.result[new_idx][:inst])
955955
compact.result[new_idx][:inst] = v
956956
count_added_node!(compact, v) && push!(compact.late_fixup, new_idx)
957957
return compact
@@ -1225,6 +1225,7 @@ function process_node!(compact::IncrementalCompact, result_idx::Int, inst::Instr
12251225
if !isa(cond, Bool)
12261226
condT = widenconditional(argextype(cond, compact))
12271227
isa(condT, Const) || @goto bail
1228+
kill_current_use!(compact, cond)
12281229
cond = condT.val
12291230
isa(cond, Bool) || @goto bail
12301231
end

base/compiler/ssair/passes.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,7 @@ function kill_phi!(compact::IncrementalCompact, phi_uses::Vector{Int},
15261526
if !delete_inst
15271527
# Deleting the inst will update compact's use count, so
15281528
# don't do it here.
1529-
kill_current_use(compact, val)
1529+
kill_current_use!(compact, val)
15301530
end
15311531
if isa(val, SSAValue)
15321532
phi_uses[val.id] -= 1

0 commit comments

Comments
 (0)