[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


http://llvm.org/bugs/show_bug.cgi?id=11591

             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
_ZN7Derived8SlowFreeEPvi
/home/nlewycky/x.cc:13
$ 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
_ZN7Derived8SlowFreeEPvi
/home/nlewycky/x.cc:14
$ 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
_ZN4Base12ReturnMemoryEPvi
/home/nlewycky/x.cc:5

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