[cfe-dev] Meaning of LLVM optimization levels

Dean Sutherland dsutherland at cert.org
Fri Jun 7 10:15:29 PDT 2013


Of course it's *possible*, in a fundamental sense. It's even pretty easy to get right in a compiler back end (in a conceptual sense). You have to touch a LOT of code, but all the changes are trivial.  We did this at Tartan Labs back in the 90s. Done with only a bit of care, it makes debugging possible at any optimization level.  The idea is to make the debug information reflect what the optimizer and code generator actually did, rather than restricting them to the linear mapping supported by most debuggers.  If anyone cares, I can even give details now that the NDAs have finally expired.

Sadly, you can't express the resulting source line information in the debug directives used by any commonly available debugger (that I am aware of).  So -- at the very most optimistic -- this approach won't get you anything any time soon.

Dean Sutherland
dsutherland at cert.org<mailto:dsutherland at cert.org>

On Jun 7, 2013, at 12:38 PM, Renato Golin <renato.golin at linaro.org<mailto:renato.golin at linaro.org>> wrote:

On 7 June 2013 13:53, Dallman, John <john.dallman at siemens.com<mailto:john.dallman at siemens.com>> wrote:
It needs to be possible to debug code at any optimisation level.

Yes, I agree. But after O1, sequential execution is a big impediment for optimizations, and keeping the debug information valid after so many transformations might pose a big penalty on the passes (time & memory). That was the whole idea of metadata being a second-class citizen.


Related to optimisation levels, it's quite helpful to have a way of controlling
optimisation on a function-by-function level. This is very useful when you're trying
to work out where in a file with many functions an optimiser problem is happening;
it isn't foolproof, but it helps a lot.

There are already people working on that, and discussions on the list about this very topic. I agree that it would be extremely helpful for debugging large programs.

cheers,
--renato
_______________________________________________
cfe-dev mailing list
cfe-dev at cs.uiuc.edu<mailto:cfe-dev at cs.uiuc.edu>
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130607/29cf2a1d/attachment.html>


More information about the cfe-dev mailing list