<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 - SimplifyCFG may drop debugloc on invokes"
   href="https://bugs.llvm.org/show_bug.cgi?id=39807">39807</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SimplifyCFG may drop debugloc on invokes
          </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>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nikita.ppv@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Running the following LLVM IR under opt -S -simplifycfg results in a verifier
error:

inlinable function call in a function with debug info must have a !dbg location
  invoke void @inlinable()
          to label %success unwind label %failure

This issue affects Rust, ref <a href="https://github.com/rust-lang/rust/issues/56265">https://github.com/rust-lang/rust/issues/56265</a>.

Suspected cause is <a href="https://reviews.llvm.org/D53390">https://reviews.llvm.org/D53390</a>, but I haven't verified this
yet.

-----

declare void @personality() 

define void @test(i1 %b) personality void()* @personality !dbg !1 {
    br i1 %b, label %if, label %else

if:
    invoke void @inlinable()
        to label %success unwind label %failure, !dbg !2

else:
    invoke void @inlinable()
        to label %success unwind label %failure, !dbg !2

success:
    ret void 

failure:
    landingpad {}
        cleanup
    ret void 
}   

define internal void @inlinable() !dbg !7 {
    ret void 
}

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!4, !5, !6}

!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, runtimeVersion: 0,
file: !3)
!1 = distinct !DISubprogram(name: "test", unit: !0)
!2 = !DILocation(line: 2, scope: !1)
!3 = !DIFile(filename: "foo", directory: ".")
!4 = !{i32 2, !"Dwarf Version", i32 4}
!5 = !{i32 2, !"Debug Info Version", i32 3}
!6 = !{i32 1, !"wchar_size", i32 4}
!7 = distinct !DISubprogram(name: "inlinable", unit: !0)</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>