Lawrence, Peter via llvm-dev
2016-Jul-19 01:42 UTC
[llvm-dev] llvm-dev Digest, Vol 145, Issue 65
All,
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.
--Peter Lawrence.
------------------------------> 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
> Message-ID:
> <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.
-- Wolfgang
**********************************