Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Register allocator should be able to preserve all local values throughout their scopes in unoptimized code to aid debugger #18696

Open Quuxplusone opened 10 years ago

Quuxplusone commented 10 years ago
Bugzilla Link PR18697
Status NEW
Importance P enhancement
Reported by Yuri (yuri@tsoft.com)
Reported on 2014-02-02 13:53:10 -0800
Last modified on 2014-02-03 15:27:23 -0800
Version trunk
Hardware PC All
CC dblaikie@gmail.com, echristo@gmail.com, hfinkel@anl.gov, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
Quuxplusone commented 10 years ago
Currently gdb often refuses to print local values when they aren't used any
more:
(gdb) p this
$11 = <optimized out>

This is because register allocator doesn't keep them after they are used last.

llvm should either alter register allocator behavior by default in unoptimized
code, always preserving values until they go out of scope, or have a special
option to do this.

This feature will be greatly appreciated by people who do debugging on llvm
generated code.
Quuxplusone commented 10 years ago

I may take an option to do this, but as a default mechanism this isn't going to happen. I'll leave this open, but anything in this area will need to be discussed.

Quuxplusone commented 10 years ago
(In reply to comment #2)
> I may take an option to do this, but as a default mechanism this isn't going
> to happen.

Just to be clear, this doesn't sound like a "-g should change codegen" request -
 but a "pessimize -O0 a bit more than we already do".

I'm assuming you're saying it won't be a default because we couldn't accept
such pessimism.

Might be right, though our current alloca approach is pretty heavy handed at -
O0 already... the only things we don't alloca are a few special cases that fall
through the cracks, not because we actually chose them for perf reasons.

Yuri - could you provide a specific reproduction. I cannot reproduce this in
simple examples.