Skip to content

Commit

Permalink
remove outdated handling of :static_parameter (#52732)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aviatesk authored Jan 5, 2024
1 parent 31a9f13 commit 316cc4a
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2339,21 +2339,8 @@ function abstract_eval_special_value(interp::AbstractInterpreter, @nospecialize(
return RTEffects(Const(e), Union{}, EFFECTS_TOTAL)
end

function abstract_eval_value_expr(interp::AbstractInterpreter, e::Expr, vtypes::Union{VarTable,Nothing}, sv::AbsIntState)
head = e.head
if head === :static_parameter
n = e.args[1]::Int
nothrow = false
if 1 <= n <= length(sv.sptypes)
sp = sv.sptypes[n]
rt = sp.typ
nothrow = !sp.undef
else
rt = Any
end
merge_effects!(interp, sv, Effects(EFFECTS_TOTAL; nothrow))
return rt
elseif head === :call
function abstract_eval_value_expr(interp::AbstractInterpreter, e::Expr, sv::AbsIntState)
if e.head === :call
# TODO: We still have non-linearized cglobal
@assert e.args[1] === Core.tuple ||
e.args[1] === GlobalRef(Core, :tuple)
Expand All @@ -2368,7 +2355,7 @@ end

function abstract_eval_value(interp::AbstractInterpreter, @nospecialize(e), vtypes::Union{VarTable,Nothing}, sv::AbsIntState)
if isa(e, Expr)
return abstract_eval_value_expr(interp, e, vtypes, sv)
return abstract_eval_value_expr(interp, e, sv)
else
(;rt, effects) = abstract_eval_special_value(interp, e, vtypes, sv)
merge_effects!(interp, sv, effects)
Expand Down Expand Up @@ -2668,7 +2655,7 @@ function abstract_eval_statement_expr(interp::AbstractInterpreter, e::Expr, vtyp
t = Bottom
effects = EFFECTS_THROWS
else
t = abstract_eval_value_expr(interp, e, vtypes, sv)
t = abstract_eval_value_expr(interp, e, sv)
# N.B.: abstract_eval_value_expr can modify the global effects, but
# we move out any arguments with effects during SSA construction later
# and recompute the effects.
Expand Down

0 comments on commit 316cc4a

Please sign in to comment.