<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - DebugInfo: Wrong value for inlined formal_parameters of a function inlined twice"
   href="https://llvm.org/bugs/show_bug.cgi?id=23260">23260</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>DebugInfo: Wrong value for inlined formal_parameters of a function inlined twice
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dexonsmith@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dblaikie@gmail.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ 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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>