Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve optimization passes to produce more compact IR #20853

Merged
merged 6 commits into from
Mar 10, 2017
Prev Previous commit
fix regressions due to replacing too many slots with SSAValues
  • Loading branch information
JeffBezanson committed Mar 10, 2017
commit 3e53392feaa9be3cf6733d4d80f929fbfe7e4870
6 changes: 6 additions & 0 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4605,6 +4605,12 @@ function get_replacement(table, var::Union{SlotNumber, SSAValue}, init::ANY, nar
return init
end
elseif isa(init, SSAValue)
if isa(var, SlotNumber) && slottypes[var.id] ⊑ Tuple
# Here we avoid replacing a Slot with an SSAValue when the type is an
# aggregate. That can cause LLVM to generate a bunch of extra memcpys
# if the data ever needs to be stack allocated later.
return var
end
if haskey(table, init)
return get_replacement(table, init, table[init], nargs, slottypes, ssavaluetypes)
end
Expand Down