[llvm-dev] llvm-dev Digest, Vol 145, Issue 65
Lawrence, Peter via llvm-dev
llvm-dev at lists.llvm.org
Mon Jul 18 18:42:23 PDT 2016
I worked on a compiler back in the (oops, that would be to revealing) XX's that
had exactly this feature. It was great. IIRC it also guaranteed that you could always
set a breakpoint at a closing curly, something else I sorely miss in gdb.
I hope it is not the case that llvm/clang will refuse to do anything new that isn't
already in gcc, I'd hate to have to wait for gcc to do this.
> Date: Thu, 14 Jul 2016 22:28:54 +0000
> From: "Pieb, Wolfgang via llvm-dev" <llvm-dev at lists.llvm.org>
> To: "llvm-dev at lists.llvm.org" <llvm-dev at lists.llvm.org>
> Subject: Re: [llvm-dev] Preventing LLVM from optimizing out a variable
> <9AF3D5FFA8DB124D9EA12ABC02DD90A69CEEE273 at USCULXMSG03.am.sony.com>
> Content-Type: text/plain; charset="utf-8"
> FyI, we (at Sony) have been experimenting with a way to keep local variables and parameters alive past their point of last use by generating an artificial (fake)use later in the instruction chain. Concretely, the idea is that the FE – under control of a command line option – generates calls to a fake.use intrinsic for all locals and parameters at or near the end of their respective lexical scopes. LLVM turns the intrinsic calls eventually into FAKE_USE machine instructions, which generate no code, but otherwise force the compiler to treat their operands as if they were live, keeping them around in registers or spilling them to the stack if necessary. Appropriate debug information is generated automatically.
So far we found that this can definitely improve debugging in the situations you describe at the expense of a slight performance penalty. We have floated this idea - restricted to the ‘this’ pointer - previously (http://lists.llvm.org/pipermail/llvm-dev/2015-September/090663.html), but the general community response was not favorable.
We still believe, however, that this feature could improve debugging of optimized code, which is quite important to our user community (game developers). We are currently in the process of gathering quantifiable data on the impact on location information and performance.
More information about the llvm-dev