[LLVMbugs] [Bug 11591] New: inline (and instcombine) changing debug info

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Dec 15 14:08:31 PST 2011


             Bug #: 11591
           Summary: inline (and instcombine) changing debug info
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This code:

extern "C" void helper(void*, const int);

  struct Base {
    void ReturnMemory(void* memory, const int size) {
      helper(memory, size);

  struct Derived : public Base {
    void Free(void* memory, int size) {
      ReturnMemory(memory, size);
    virtual void SlowFree(void *memory, int size) {
      Free(memory, size);

  void f() {
    new Derived;

has correct debug info when built at -O0. Now, the debug info I'm interested in
is *not* the CIE for the function -- that stays correct after -O2 (the
DW_AT_decl_line after the DW_TAG_subprogram as dumped by dwarfdump). What's
changing is the line number for the first instruction of the function.

$ opt x.bc -o y.bc && llc -filetype=obj y.bc -o y.o
$ echo 0 | addr2line -j .text._ZN7Derived8SlowFreeEPvi -f -e y.o
$ opt -instcombine x.bc -o y.bc && llc -filetype=obj y.bc -o y.o
$ echo 0 | addr2line -j .text._ZN7Derived8SlowFreeEPvi -f -e y.o
$ opt -inline -instcombine x.bc -o y.bc && llc -filetype=obj y.bc -o y.o
$ echo 0 | addr2line -j .text._ZN7Derived8SlowFreeEPvi -f -e y.o

That's the line number it shows (line 5) when built with clang -O2. That should
stay at 13.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list