-
Notifications
You must be signed in to change notification settings - Fork 13.4k
arguments <optimized out>
when optimizations remove unused data fields
#46698
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
Comments
Our first theory when talking about it was that it was from the call to |
Triage: this reproduces today on pc-windows-gnu:
|
I've been running into this a lot lately with -O3 (on Rust 1.41.0). Most of the variables are optimized out, and our debug build is very slow compared to the release build, so it feels like a blocker for me. |
Did you try running your debug builds at an intermediary optimization level of 1 or 2? Tuning my debug builds to opt-level=1 proved to be a good way to handle the debuginfo vs optimization tradeoff on some of my projects where opt-level=0 is unbearably slow. |
I tried opt-level=1 and it's still optimized out entirely. |
Visited during wg-debugging triage. LLVM is doing something interesting here (testing with Rust 1.68): ; example::foo
; Function Attrs: mustprogress nofree noinline norecurse nosync nounwind nonlazybind readnone willreturn uwtable
define internal fastcc noundef i64 @_ZN7example3foo17ha5f3a2efc30301c8E(i64 noundef %x.1, i64 noundef %y.1) unnamed_addr #2 !dbg !760 {
start:
call void @llvm.dbg.value(metadata ptr poison, metadata !766, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg !768
call void @llvm.dbg.value(metadata i64 %x.1, metadata !766, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg !768
call void @llvm.dbg.value(metadata ptr poison, metadata !767, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg !768
call void @llvm.dbg.value(metadata i64 %y.1, metadata !767, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg !768
%0 = add i64 %y.1, %x.1, !dbg !769
ret i64 %0, !dbg !770
} LLVM has observed that of the pair of
which is probably because the debuginfo still describes the types of the arguments as being
Improving/fixing the locations would probably give us back the "optimized out" gdb message which seems entirely accurate in this case. I don't think it's going to be generally possible to make |
<optimized out>
when optimizations are enabled<optimized out>
when optimizations remove unused data fields
I believe the compiler output is correct and it's the debuggers that are wrong here. I sent https://lists.dwarfstd.org/pipermail/dwarf-discuss/2024-February/002375.html about clarifying the DWARF spec. |
I tried this again today. First, I don't think gdb has an issue with an empty leading piece. See https://sourceware.org/bugzilla/show_bug.cgi?id=31427 I filed https://sourceware.org/bugzilla/show_bug.cgi?id=31431 for the gdb side. Note that currently I get this output, which isn't great but also isn't really incorrect:
|
Ah, interesting. Personally I think gdb's |
Could we get LLVM to emit altered debug info in the form of a variable record for |
Debuggers are supposed to present a source level view. It would be weird to rewrite the function signature in the debug info. |
This program:
when compiled with optimizations enabled, seems to strip out all of the local variable information:
cc @tromey
The text was updated successfully, but these errors were encountered: