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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to