Skip to content

Commit

Permalink
forward-port the test cases added in #53076
Browse files Browse the repository at this point in the history
The fix for #53062 was included in #50805, but it lacked explicit test
cases added. This commit cherry-picks the test cases from #53076 to
prevent future regression.
  • Loading branch information
aviatesk committed Jan 27, 2024
1 parent c32aeb5 commit b6922e2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/compiler/ssair/inlining.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,7 @@ function compute_inlining_cases(@nospecialize(info::CallInfo), flag::UInt32, sig
fully_covered &= split_fully_covered
end

(handled_all_cases && fully_covered) || (joint_effects = Effects(joint_effects; nothrow=false))
(handled_all_cases & 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
17 changes: 17 additions & 0 deletions test/compiler/inline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2116,3 +2116,20 @@ let src = code_typed1() do
end
@test count(isinvoke(:iterate), src.code) == 0
end

# JuliaLang/julia#53062: proper `joint_effects` for call with empty method matches
let ir = first(only(Base.code_ircode(setproperty!, (Base.RefValue{Int},Symbol,Base.RefValue{Int}))))
i = findfirst(iscall((ir, convert)), ir.stmts.stmt)::Int
@test iszero(ir.stmts.flag[i] & Core.Compiler.IR_FLAG_NOTHROW)
end
function issue53062(cond)
x = Ref{Int}(0)
if cond
x[] = x
else
return -1
end
end
@test !Core.Compiler.is_nothrow(Base.infer_effects(issue53062, (Bool,)))
@test issue53062(false) == -1
@test_throws MethodError issue53062(true)

0 comments on commit b6922e2

Please sign in to comment.