[LLVMbugs] [Bug 23260] New: DebugInfo: Wrong value for inlined formal_parameters of a function inlined twice

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Apr 16 18:05:18 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23260

            Bug ID: 23260
           Summary: DebugInfo: Wrong value for inlined formal_parameters
                    of a function inlined twice
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: dexonsmith at apple.com
                CC: dblaikie at gmail.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ cat t.c
void sink(void);
static __attribute__((always_inline)) void bar(int a) { sink(); }
void foo(void) {
  bar(0);
  bar(1);
}

$ clang -g -O2 t.c -S -emit-llvm -o - | grep llvm.dbg.value
  tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !12, metadata
!17) #3, !dbg !18
  tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !12, metadata
!17) #3, !dbg !21
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2

Notice that both intrinsics get `i32 0`.

This happens during dead argument elimination.

*** IR Dump After Dead Argument Elimination ***; ModuleID = 't.c'
; Function Attrs: alwaysinline nounwind ssp uwtable
define internal fastcc void @bar() #1 {
entry:
  call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !12, metadata !20),
!dbg !21
  call void @sink(), !dbg !22
  ret void, !dbg !23
}


I suspect the right solution is to lose the variable entirely.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150417/4ea925ce/attachment.html>


More information about the llvm-bugs mailing list