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

Make SROA pass more aggressive + make SSA use counting more accurate #44557

Merged
merged 1 commit into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions base/compiler/ssair/inlining.jl
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ function ir_inline_item!(compact::IncrementalCompact, idx::Int, argexprs::Vector
stmt′ = ssa_substitute!(idx′, stmt′, argexprs, sig, sparam_vals, linetable_offset, boundscheck, compact)
if isa(stmt′, ReturnNode)
val = stmt′.val
isa(val, SSAValue) && (compact.used_ssas[val.id] += 1)
return_value = SSAValue(idx′)
inline_compact[idx′] = val
Comment on lines -374 to 375
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inline_compact[idx′] = val calls count_added_node!, which increments inline_compact.used_ssas, which === compact.used_ssas, so incrementing here is incorrect

inline_compact.result[idx′][:type] =
Expand Down Expand Up @@ -428,13 +427,6 @@ function ir_inline_item!(compact::IncrementalCompact, idx::Int, argexprs::Vector
just_fixup!(inline_compact)
compact.result_idx = inline_compact.result_idx
compact.active_result_bb = inline_compact.active_result_bb
for i = 1:length(pn.values)
isassigned(pn.values, i) || continue
v = pn.values[i]
if isa(v, SSAValue)
compact.used_ssas[v.id] += 1
end
end
Comment on lines -431 to -437
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, if length(pn.edges) != 1, we call insert_node_here! on NewInstruction(pn..., which does this same incrementing. In the case where we just return pn.values[1], I'm not sure if there are paths that result in this getting counted twice, but we can at least make this change for now

if length(pn.edges) == 1
return_value = pn.values[1]
else
Expand Down
Loading