Skip to content

Commit 1c11fb2

Browse files
committed
inlining: fix the joint_effects calculation (#50117)
There are cases when `joint_effects` already has `:nothrow` tainted while the matches are fully covered.
1 parent 708c56a commit 1c11fb2

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

base/compiler/abstractinterpretation.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2441,11 +2441,9 @@ function abstract_eval_globalref(interp::AbstractInterpreter, g::GlobalRef, fram
24412441
nothrow = false
24422442
if isa(rt, Const)
24432443
consistent = ALWAYS_TRUE
2444+
nothrow = true
24442445
if is_mutation_free_argtype(rt)
24452446
inaccessiblememonly = ALWAYS_TRUE
2446-
nothrow = true
2447-
else
2448-
nothrow = true
24492447
end
24502448
elseif isdefined_globalref(g)
24512449
nothrow = true

base/compiler/ssair/inlining.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1401,7 +1401,7 @@ function compute_inlining_cases(@nospecialize(info::CallInfo), flag::UInt8, sig:
14011401
fully_covered &= split_fully_covered
14021402
end
14031403

1404-
joint_effects = Effects(joint_effects; nothrow=fully_covered)
1404+
fully_covered || (joint_effects = Effects(joint_effects; nothrow=false))
14051405

14061406
if handled_all_cases && revisit_idx !== nothing
14071407
# we handled everything except one match with unmatched sparams,

test/compiler/irutils.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import Core: CodeInfo, ReturnNode, MethodInstance
22
import Core.Compiler: IRCode, IncrementalCompact, argextype, singleton_type
33
import Base.Meta: isexpr
4+
using InteractiveUtils: gen_call_with_extracted_types_and_kwargs
45

56
argextype(@nospecialize args...) = argextype(args..., Any[])
67
code_typed1(args...; kwargs...) = first(only(code_typed(args...; kwargs...)))::CodeInfo
8+
macro code_typed1(ex0...)
9+
return gen_call_with_extracted_types_and_kwargs(__module__, :code_typed1, ex0)
10+
end
711
get_code(args...; kwargs...) = code_typed1(args...; kwargs...).code
812

913
# check if `x` is a statement with a given `head`

0 commit comments

Comments
 (0)