Skip to content

Commit

Permalink
inlining: fix the joint_effects calculation (#50117)
Browse files Browse the repository at this point in the history
There are cases when `joint_effects` already has `:nothrow` tainted while the matches are
fully covered.
  • Loading branch information
aviatesk committed Jun 12, 2023
1 parent 708c56a commit 1c11fb2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 1 addition & 3 deletions base/compiler/abstractinterpretation.jl
Expand Up @@ -2441,11 +2441,9 @@ function abstract_eval_globalref(interp::AbstractInterpreter, g::GlobalRef, fram
nothrow = false
if isa(rt, Const)
consistent = ALWAYS_TRUE
nothrow = true
if is_mutation_free_argtype(rt)
inaccessiblememonly = ALWAYS_TRUE
nothrow = true
else
nothrow = true
end
elseif isdefined_globalref(g)
nothrow = true
Expand Down
2 changes: 1 addition & 1 deletion base/compiler/ssair/inlining.jl
Expand Up @@ -1401,7 +1401,7 @@ function compute_inlining_cases(@nospecialize(info::CallInfo), flag::UInt8, sig:
fully_covered &= split_fully_covered
end

joint_effects = Effects(joint_effects; nothrow=fully_covered)
fully_covered || (joint_effects = Effects(joint_effects; nothrow=false))

if handled_all_cases && revisit_idx !== nothing
# we handled everything except one match with unmatched sparams,
Expand Down
4 changes: 4 additions & 0 deletions test/compiler/irutils.jl
@@ -1,9 +1,13 @@
import Core: CodeInfo, ReturnNode, MethodInstance
import Core.Compiler: IRCode, IncrementalCompact, argextype, singleton_type
import Base.Meta: isexpr
using InteractiveUtils: gen_call_with_extracted_types_and_kwargs

argextype(@nospecialize args...) = argextype(args..., Any[])
code_typed1(args...; kwargs...) = first(only(code_typed(args...; kwargs...)))::CodeInfo
macro code_typed1(ex0...)
return gen_call_with_extracted_types_and_kwargs(__module__, :code_typed1, ex0)
end
get_code(args...; kwargs...) = code_typed1(args...; kwargs...).code

# check if `x` is a statement with a given `head`
Expand Down

0 comments on commit 1c11fb2

Please sign in to comment.