<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Debug info affects output from "opt -inline -adce""
   href="https://bugs.llvm.org/show_bug.cgi?id=43291">43291</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Debug info affects output from "opt -inline -adce"
          </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>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Interprocedural Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mikael.holmen@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22487" name="attach_22487" title="ll reproducer">attachment 22487</a> <a href="attachment.cgi?id=22487&action=edit" title="ll reproducer">[details]</a></span>
ll reproducer

Reprocuce with:

opt -S -o - bbi-32603.ll -inline -adce

which produces

define i16 @g() !dbg !33 {
  %volatileloadslot.i = alloca %rec1198
  call void @llvm.dbg.value(metadata i16 0, metadata !30, metadata
!DIExpression()), !dbg !36
  %volatileloadslot.0..sroa_cast.i = bitcast %rec1198* %volatileloadslot.i to
i8*, !dbg !38
  call void @llvm.lifetime.start.p0i8(i64 4, i8*
%volatileloadslot.0..sroa_cast.i)
  %volatileloadslot.0..sroa_cast1.i = bitcast %rec1198* %volatileloadslot.i to
i8*
  call void @llvm.lifetime.end.p0i8(i64 4, i8*
%volatileloadslot.0..sroa_cast1.i)
  br label %bb1

bb1:                                              ; preds = %0
  ret i16 0
}

If we just remove

, !dbg !32

from

  %volatileloadslot.0..sroa_cast = bitcast %rec1198* %volatileloadslot to i8*,
!dbg !32

in the input we instead get:

define i16 @g() !dbg !30 {
  %volatileloadslot.i = alloca %rec1198
  %l.6.i = alloca [3 x i32]
  %1 = bitcast [3 x i32]* %l.6.i to i8*
  call void @llvm.lifetime.start.p0i8(i64 12, i8* %1)
  %volatileloadslot.0..sroa_cast.i = bitcast %rec1198* %volatileloadslot.i to
i8*
  call void @llvm.lifetime.start.p0i8(i64 4, i8*
%volatileloadslot.0..sroa_cast.i)
  %volatileloadslot.0..sroa_cast1.i = bitcast %rec1198* %volatileloadslot.i to
i8*
  call void @llvm.lifetime.end.p0i8(i64 4, i8*
%volatileloadslot.0..sroa_cast1.i)
  %2 = bitcast [3 x i32]* %l.6.i to i8*
  call void @llvm.lifetime.end.p0i8(i64 12, i8* %2)
  br label %bb1

bb1:                                              ; preds = %0
  ret i16 0
}


Looking at -debug printouts the first difference we see is that adce removes
the

call void @llvm.dbg.value(metadata i16 %k.4.par, metadata !30, metadata
!DIExpression()), !dbg !31

when the

, !dbg !32

isn't present on the bitcast, and then before we run the inliner we see this

CGSCCPASSMGR: Pass Dirtied SCC: Function Pass Manager
CGSCCPASSMGR: Refreshing SCC with 1 nodes:
Call graph node for function: 'f'<<0x643aed0>>  #uses=2

CGSCCPASSMGR: SCC Refresh didn't change call graph.

which isn't there when don't remove the

, !dbg !32</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>