JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.55k stars 5.47k forks source link

`@code_llvm` with `debuginfo=:none` does not remove all debug info on Julia 1.11 #54577

Open MilesCranmer opened 4 months ago

MilesCranmer commented 4 months ago
julia> f(x) = x;

julia> @code_llvm debuginfo=:none f(1)
; Function Signature: f(Int64)
define i64 @julia_f_3669(i64 signext %"x::Int64") #0 {
top:
  ret i64 %"x::Int64"
}

The ; Function Signature: f(Int64) is debug info so should not be printed here.

On 1.10:

julia> f(x) = x;

julia> @code_llvm debuginfo=:none f(1)
define i64 @julia_f_787(i64 signext %0) #0 {
top:
  ret i64 %0
}
giordano commented 4 months ago

For what is worth, the signature line was introduced in v1.11, it doesn't appear in v1.10 because it wasn't there in the first place. Agreed that it may be considered "debug info".

MilesCranmer commented 4 months ago

I figured that, just wanted to point out it wasn't being removed by the filter

giordano commented 4 months ago

This was introduced by #50630, but as far as I understand debug level is part of jl_codegen_params_t, but I don't see that used at all in that file, so I have no clue how one would conditionally print the signature depending on the debug level if codegen params are never available at that point.

MilesCranmer commented 4 months ago

No idea

In my LLVM IR unittest I just made it filter any line starting with ; so it would be compatible with 1.11.