[LLVMbugs] [Bug 7129] New: clang -O1 -g doesn't add !dbg metadata, but clang -g -O0 + opt -O1 has !dbg metadata

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 13 02:19:27 PDT 2010


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

           Summary: clang -O1 -g doesn't add !dbg metadata, but clang -g
                    -O0 + opt -O1 has !dbg metadata
           Product: clang
           Version: 2.7
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=4884)
 --> (http://llvm.org/bugs/attachment.cgi?id=4884)
testcase

With Clang 2.7.

On the attached testcase:
-O0 -g generates proper debug info:
$ clang -w -O0 -g x.i -emit-llvm -S -o -|grep hex2int 
  %call23.i.i.i = call i32 (...)* @cli_hex2int(i32 %conv22.i.i.i) nounwind,
!dbg !146 ; <i32> [#uses=1]
  %call30.i.i.i = call i32 (...)* @cli_hex2int(i32 %conv29.i.i.i) nounwind,
!dbg !146 ; <i32> [#uses=1]
declare i32 @cli_hex2int(...)

But -O1 -g doesn't have it anymore:
$ clang -w -O1 -g x.i -emit-llvm -S -o -|grep hex2int 
  %call23.i.i.i = call i32 (...)* @cli_hex2int(i32 %conv22.i.i.i) nounwind ;
<i32> [#uses=1]
  %call30.i.i.i = call i32 (...)* @cli_hex2int(i32 %conv29.i.i.i) nounwind ;
<i32> [#uses=1]
declare i32 @cli_hex2int(...)

If I save -O0 to bitcode and use opt -O1 the debug info is still there:
$ clang -w -O0 -g x.i -emit-llvm -c -o x.bc
$ opt -O1 x.bc -S -o -|grep hex2int
  %call23.i.i.i = call i32 (...)* @cli_hex2int(i32 %conv22.i.i.i) nounwind,
!dbg !63 ; <i32> [#uses=1]
  %call30.i.i.i = call i32 (...)* @cli_hex2int(i32 %conv29.i.i.i) nounwind,
!dbg !63 ; <i32> [#uses=1]
declare i32 @cli_hex2int(...)

Looks like something related to always_inline attribute, if I remove it from
the first function, then there is !dbg metadata.
Is clang's inliner loosing track of debug locations?

-- 
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