<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 - "inlinable function call in a function with debug info must have a !dbg location" after running -reassociate"
   href="https://bugs.llvm.org/show_bug.cgi?id=34231">34231</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"inlinable function call in a function with debug info must have a !dbg location" after running -reassociate
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>david.stenberg@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=19003" name="attach_19003" title="Reduced reproducer.">attachment 19003</a> <a href="attachment.cgi?id=19003&action=edit" title="Reduced reproducer.">[details]</a></span>
Reduced reproducer.

When running the following command-line using opt from top-of-trunk (r311044):

    $ opt -S -reassociate -o /dev/null reproducer.ll

the following crash is seen when running the Reassociate pass:

    inlinable function call in a function with debug info must have a !dbg
location
      %inlinable_call = call i16 @fn1()
    opt: ../lib/IR/Verifier.cpp:4683: virtual bool (anonymous
namespace)::VerifierLegacyPass::doFinalization(llvm::Module &): Assertion
`!V->hasBrokenDebugInfo() && "Module contains invalid debug info"' failed.
    #0 0x00000000030cbb5c llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/repo/llvm-master/build-all-Debug/../lib/Support/Unix/Signals.inc:398:5
    #1 0x00000000030cbd09 PrintStackTraceSignalHandler(void*)
/repo/llvm-master/build-all-Debug/../lib/Support/Unix/Signals.inc:462:1
    #2 0x00000000030ca303 llvm::sys::RunSignalHandlers()
/repo/llvm-master/build-all-Debug/../lib/Support/Signals.cpp:50:5
    #3 0x00000000030cc34e SignalHandler(int)
/repo/llvm-master/build-all-Debug/../lib/Support/Unix/Signals.inc:252:1
    #4 0x00007f08b1d46850 __restore_rt (/lib64/libpthread.so.0+0xf850)
    #5 0x00007f08b0ef1875 __GI_raise (/lib64/libc.so.6+0x32875)
    #6 0x00007f08b0ef2e51 __GI_abort (/lib64/libc.so.6+0x33e51)
    #7 0x00007f08b0eea740 __GI___assert_fail (/lib64/libc.so.6+0x2b740)
    #8 0x00000000029583da (anonymous
namespace)::VerifierLegacyPass::doFinalization(llvm::Module&)
/repo/llvm-master/build-all-Debug/../lib/IR/Verifier.cpp:4684:5
    #9 0x00000000028c975c llvm::FPPassManager::doFinalization(llvm::Module&)
/repo/llvm-master/build-all-Debug/../lib/IR/LegacyPassManager.cpp:1553:16
    #10 0x00000000028ca081 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/repo/llvm-master/build-all-Debug/../lib/IR/LegacyPassManager.cpp:1609:16
    #11 0x00000000028c98fb llvm::legacy::PassManagerImpl::run(llvm::Module&)
/repo/llvm-master/build-all-Debug/../lib/IR/LegacyPassManager.cpp:1694:16
    #12 0x00000000028ca341 llvm::legacy::PassManager::run(llvm::Module&)
/repo/llvm-master/build-all-Debug/../lib/IR/LegacyPassManager.cpp:1725:3
    #13 0x0000000000b3e77f main
/repo/llvm-master/build-all-Debug/../tools/opt/opt.cpp:756:3
    #14 0x00007f08b0eddc36 __libc_start_main (/lib64/libc.so.6+0x1ec36)
    #15 0x0000000000b13239 _start
/usr/src/packages/BUILD/glibc-2.11.3/csu/../sysdeps/x86_64/elf/start.S:116:0
    Stack dump:
    0.  Program arguments: /repo/llvm-master/build-all-Debug/./bin/opt -S
-reassociate -o /dev/null reproducer.ll

The

    %inlinable_call = call i16 @fn1(), !dbg !7

instruction's debug location is dropped when replacing it with the debug
location for

    %dbgless_instruction = or i16 %inlinable_call, 0

when running ReassociatePass::ReassociateExpression:

    2133     if (Instruction *VI = dyn_cast<Instruction>(V))
    2134       VI->setDebugLoc(I->getDebugLoc());</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>