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 IRShow.method_name inferrable #49607

Merged
merged 3 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
15 changes: 11 additions & 4 deletions base/compiler/ssair/inlining.jl
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,17 @@ function finish_cfg_inline!(state::CFGInliningState)
end

# duplicated from IRShow
normalize_method_name(m::Method) = m.name
normalize_method_name(m::MethodInstance) = (m.def::Method).name
normalize_method_name(m::Symbol) = m
normalize_method_name(m) = Symbol("")
function normalize_method_name(m)
if m isa Method
return m.name
elseif m isa MethodInstance
return (m.def::Method).name
elseif m isa Symbol
return m
else
return Symbol("")
end
end
@noinline method_name(m::LineInfoNode) = normalize_method_name(m.method)

inline_node_is_duplicate(topline::LineInfoNode, line::LineInfoNode) =
Expand Down
15 changes: 11 additions & 4 deletions base/compiler/ssair/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,17 @@ function default_expr_type_printer(io::IO; @nospecialize(type), used::Bool, show
return nothing
end

normalize_method_name(m::Method) = m.name
normalize_method_name(m::MethodInstance) = (m.def::Method).name
normalize_method_name(m::Symbol) = m
normalize_method_name(m) = Symbol("")
function normalize_method_name(m)
if m isa Method
return m.name
elseif m isa MethodInstance
return (m.def::Method).name
elseif m isa Symbol
return m
else
return Symbol("")
end
end
@noinline method_name(m::LineInfoNode) = normalize_method_name(m.method)

# converts the linetable for line numbers
Expand Down