Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete trust_inference option #50432

Merged
merged 2 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions base/compiler/ssair/inlining.jl
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function cfg_inline_unionsplit!(ir::IRCode, idx::Int,
push!(from_bbs, length(state.new_cfg_blocks))
# TODO: Right now we unconditionally generate a fallback block
# in case of subtyping errors - This is probably unnecessary.
if i != length(cases) || (!fully_covered || (!params.trust_inference))
if i != length(cases) || (!fully_covered)
# This block will have the next condition or the final else case
push!(state.new_cfg_blocks, BasicBlock(StmtRange(idx, idx)))
push!(state.new_cfg_blocks[cond_bb].succs, length(state.new_cfg_blocks))
Expand Down Expand Up @@ -575,7 +575,7 @@ function ir_inline_unionsplit!(compact::IncrementalCompact, idx::Int,
cond = true
nparams = fieldcount(atype)
@assert nparams == fieldcount(mtype)
if i != ncases || !fully_covered || !params.trust_inference
if i != ncases || !fully_covered
for i = 1:nparams
a, m = fieldtype(atype, i), fieldtype(mtype, i)
# If this is always true, we don't need to check for it
Expand Down Expand Up @@ -630,14 +630,7 @@ function ir_inline_unionsplit!(compact::IncrementalCompact, idx::Int,
end
bb += 1
# We're now in the fall through block, decide what to do
if fully_covered
if !params.trust_inference
e = Expr(:call, GlobalRef(Core, :throw), FATAL_TYPE_BOUND_ERROR)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason you didn't remove the FATAL_TYPE_BOUND_ERROR definition?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this the only use of it? If so the reason is because I didn't notice that there weren't any other uses.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

insert_node_here!(compact, NewInstruction(e, Union{}, line))
insert_node_here!(compact, NewInstruction(ReturnNode(), Union{}, line))
finish_current_bb!(compact, 0)
end
else
if !fully_covered
ssa = insert_node_here!(compact, NewInstruction(stmt, typ, line))
push!(pn.edges, bb)
push!(pn.values, ssa)
Expand Down
10 changes: 0 additions & 10 deletions base/compiler/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,6 @@ Parameters that control optimizer operation.
generating `:invoke` expression based on the [`@nospecialize`](@ref) annotation,
in order to avoid over-specialization.
---
- `opt_params.trust_inference::Bool = false`\\
If `false`, the inliner will unconditionally generate a fallback block when union-splitting
a callsite, in case of existing subtyping bugs. This option may be removed in the future.
---
- `opt_params.assume_fatal_throw::Bool = false`\\
If `true`, gives the optimizer license to assume that any `throw` is fatal and thus the
state after a `throw` is not externally observable. In particular, this gives the
Expand All @@ -266,7 +262,6 @@ struct OptimizationParams
inline_error_path_cost::Int
max_tuple_splat::Int
compilesig_invokes::Bool
trust_inference::Bool
assume_fatal_throw::Bool

function OptimizationParams(
Expand All @@ -277,7 +272,6 @@ struct OptimizationParams
inline_error_path_cost::Int,
max_tuple_splat::Int,
compilesig_invokes::Bool,
trust_inference::Bool,
assume_fatal_throw::Bool)
return new(
inlining,
Expand All @@ -287,7 +281,6 @@ struct OptimizationParams
inline_error_path_cost,
max_tuple_splat,
compilesig_invokes,
trust_inference,
assume_fatal_throw)
end
end
Expand All @@ -300,7 +293,6 @@ function OptimizationParams(
#=inline_error_path_cost::Int=# 20,
#=max_tuple_splat::Int=# 32,
#=compilesig_invokes::Bool=# true,
#=trust_inference::Bool=# false,
#=assume_fatal_throw::Bool=# false);
inlining::Bool = params.inlining,
inline_cost_threshold::Int = params.inline_cost_threshold,
Expand All @@ -309,7 +301,6 @@ function OptimizationParams(
inline_error_path_cost::Int = params.inline_error_path_cost,
max_tuple_splat::Int = params.max_tuple_splat,
compilesig_invokes::Bool = params.compilesig_invokes,
trust_inference::Bool = params.trust_inference,
assume_fatal_throw::Bool = params.assume_fatal_throw)
return OptimizationParams(
inlining,
Expand All @@ -319,7 +310,6 @@ function OptimizationParams(
inline_error_path_cost,
max_tuple_splat,
compilesig_invokes,
trust_inference,
assume_fatal_throw)
end

Expand Down