[LLVMdev] Optimization passes and debug info

Chris Lattner sabre at nondot.org
Wed Jul 9 21:46:27 PDT 2008


On Jul 8, 2008, at 3:33 AM, Matthijs Kooijman wrote:
> Hi all,
>
> I've been fiddling around with debug info generated by clang, with  
> the goal of
> propagating line number info to our custom backend (which is not an  
> llvm
> backend, but does use llvm IR as its input).

Cool.

> I've created a small pass which strips all debug info except for  
> stop points,
> which are currently the only things we're interested in. Leaving  
> only stop
> points in actually works surprisingly well, most transformation  
> passes keep
> doing their work properly.

Ok

> From this observation, I think it might be useful to have some kind  
> of global
> flag that tells transformations whether it is allowed to remove  
> debugging code
> in favour of optimizations. When we start making transformation passes
> debug-info aware, I think the need for something like this might  
> increase.

I think that the right answer for llvm-gcc at "-O3 -g" is (eventually)  
for debug info to be updated where possible but discarded when  
necessary as you describe.  For llvm-gcc we really really want the non- 
debug related output of the compiler to be identical between "-O3" and  
"-O3 -g", and discarding this information is a reasonable way to do  
this.

If you're interested in a path forward, I describe one reasonable one  
here:
http://nondot.org/sabre/LLVMNotes/DebugInfoImprovements.txt

-Chris



More information about the llvm-dev mailing list