Skip to content

Commit a531077

Browse files
committed
remove outdated handling of :static_parameter
After #51970, `Expr(:static_parameter, i::Int)` is now consistently outlined during the lowering, so there's no longer a need for `abstract_eval_value_expr` to handle this expression. This update removes the outdated handling, clarifying where we need to handle the expression.
1 parent f9b27b3 commit a531077

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

base/compiler/abstractinterpretation.jl

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,21 +2339,8 @@ function abstract_eval_special_value(interp::AbstractInterpreter, @nospecialize(
23392339
return RTEffects(Const(e), Union{}, EFFECTS_TOTAL)
23402340
end
23412341

2342-
function abstract_eval_value_expr(interp::AbstractInterpreter, e::Expr, vtypes::Union{VarTable,Nothing}, sv::AbsIntState)
2343-
head = e.head
2344-
if head === :static_parameter
2345-
n = e.args[1]::Int
2346-
nothrow = false
2347-
if 1 <= n <= length(sv.sptypes)
2348-
sp = sv.sptypes[n]
2349-
rt = sp.typ
2350-
nothrow = !sp.undef
2351-
else
2352-
rt = Any
2353-
end
2354-
merge_effects!(interp, sv, Effects(EFFECTS_TOTAL; nothrow))
2355-
return rt
2356-
elseif head === :call
2342+
function abstract_eval_value_expr(interp::AbstractInterpreter, e::Expr, sv::AbsIntState)
2343+
if e.head === :call
23572344
# TODO: We still have non-linearized cglobal
23582345
@assert e.args[1] === Core.tuple ||
23592346
e.args[1] === GlobalRef(Core, :tuple)
@@ -2368,7 +2355,7 @@ end
23682355

23692356
function abstract_eval_value(interp::AbstractInterpreter, @nospecialize(e), vtypes::Union{VarTable,Nothing}, sv::AbsIntState)
23702357
if isa(e, Expr)
2371-
return abstract_eval_value_expr(interp, e, vtypes, sv)
2358+
return abstract_eval_value_expr(interp, e, sv)
23722359
else
23732360
(;rt, effects) = abstract_eval_special_value(interp, e, vtypes, sv)
23742361
merge_effects!(interp, sv, effects)
@@ -2668,7 +2655,7 @@ function abstract_eval_statement_expr(interp::AbstractInterpreter, e::Expr, vtyp
26682655
t = Bottom
26692656
effects = EFFECTS_THROWS
26702657
else
2671-
t = abstract_eval_value_expr(interp, e, vtypes, sv)
2658+
t = abstract_eval_value_expr(interp, e, sv)
26722659
# N.B.: abstract_eval_value_expr can modify the global effects, but
26732660
# we move out any arguments with effects during SSA construction later
26742661
# and recompute the effects.

base/compiler/ssair/irinterp.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ populate_def_use_map!(tpdum::TwoPhaseDefUseMap, ir::IRCode) =
288288
function is_all_const_call(@nospecialize(stmt), interp::AbstractInterpreter, irsv::IRInterpretationState)
289289
isexpr(stmt, :call) || return false
290290
@inbounds for i = 2:length(stmt.args)
291-
argtype = abstract_eval_value(interp, stmt.args[i], nothing, irsv)
291+
argtype = abstract_eval_value(interp, stmt.args[i], irsv)
292292
is_const_argtype(argtype) || return false
293293
end
294294
return true

0 commit comments

Comments
 (0)