Skip to content

Commit

Permalink
tweak outdated test cases (#51994)
Browse files Browse the repository at this point in the history
Now those concretized calls are DCE-ed even though they are inlineable.
So we don't need to call e.g. `cfg_simplify!`.
  • Loading branch information
aviatesk authored Nov 3, 2023
1 parent 5eaad53 commit f2a5fb9
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions test/compiler/inline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1840,26 +1840,16 @@ end
# Test that inlining can still use nothrow information from concrete-eval
# even if the result itself is too big to be inlined, and nothrow is not
# known without concrete-eval
const THE_BIG_TUPLE = ntuple(identity, 1024)
const THE_BIG_TUPLE = ntuple(identity, 1024);
function return_the_big_tuple(err::Bool)
err && error("BAD")
return THE_BIG_TUPLE
end
@noinline function return_the_big_tuple_noinline(err::Bool)
err && error("BAD")
return THE_BIG_TUPLE
@test fully_eliminated() do
return_the_big_tuple(false)[1]
end
big_tuple_test1() = return_the_big_tuple(false)[1]
big_tuple_test2() = return_the_big_tuple_noinline(false)[1]

@test fully_eliminated(big_tuple_test2, Tuple{})
# Currently we don't run these cleanup passes, but let's make sure that
# if we did, inlining would be able to remove this
let ir = Base.code_ircode(big_tuple_test1, Tuple{})[1][1]
ir = Core.Compiler.compact!(ir, true)
ir = Core.Compiler.cfg_simplify!(ir)
ir = Core.Compiler.compact!(ir, true)
@test length(ir.stmts) == 1
@test fully_eliminated() do
@inline return_the_big_tuple(false)[1]
end

# inlineable but removable call should be eligible for DCE
Expand Down

0 comments on commit f2a5fb9

Please sign in to comment.