Skip to content

Commit f45a49b

Browse files
author
Ian Atol
committed
Add UseRefIterator elimination test
1 parent 4a2f668 commit f45a49b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/compiler/irpasses.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,3 +831,11 @@ let ci = code_typed(foo_cfg_empty, Tuple{Bool}, optimize=true)[1][1]
831831
@test length(ir.cfg.blocks) <= 2
832832
@test isa(ir.stmts[length(ir.stmts)][:inst], ReturnNode)
833833
end
834+
835+
# Test that UseRefIterator gets SROA'd inside of new_to_regular (#44557)
836+
# expression and new_to_regular offset are arbitrary here, we just want to see the UseRefIterator erased
837+
let e = Expr(:call, Core.GlobalRef(Base, :arrayset), false, Core.SSAValue(4), Core.SSAValue(9), Core.SSAValue(8))
838+
new_to_reg(expr) = Core.Compiler.new_to_regular(expr, 1)
839+
@allocated new_to_reg(e) # warmup call
840+
@test (@allocated new_to_reg(e)) == 0
841+
end

0 commit comments

Comments
 (0)