<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 - [SimplifyCFGPass] mergeEmptyReturnBlocks() leaves broken callbr (asm goto) instruction."
   href="https://bugs.llvm.org/show_bug.cgi?id=45062">45062</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[SimplifyCFGPass]  mergeEmptyReturnBlocks() leaves broken callbr (asm goto) instruction.
          </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>normal
          </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>paulsson@linux.vnet.ibm.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=23188" name="attach_23188" title="reduced testcase">attachment 23188</a> <a href="attachment.cgi?id=23188&action=edit" title="reduced testcase">[details]</a></span>
reduced testcase

define void @j() {
bb:
  callbr void asm sideeffect "", "X"(i8* blockaddress(@j, %bb4))
          to label %bb13 [label %bb4]

bb4:                                              ; preds = %bb
  ret void

bb13:                                             ; preds = %bb
  ret void
}

-> /bin/opt ./tc_callbr.ll -simplifycfg

define void @j() {
bb:
  callbr void asm sideeffect "", "X"(i8* blockaddress(@j, %bb4))
          to label %bb4 [label %bb4]

bb4:                                              ; preds = %bb, %bb
  ret void
}

Duplicate callbr destination!
  callbr void asm sideeffect "", "X"(i8* blockaddress(@j, %bb4))
          to label %bb4 [label %bb4]
in function j
LLVM ERROR: Broken function found, compilation aborted!

Since a callbr is not allowed to have duplicate labels, the %bb4 argument and
indirect label must be removed but it is not done.

Perhaps SimplifyCFG should do this, or perhaps calling BB.replaceAllUsesWith()
should take care of this with a call similar to
BB->replaceSuccessorsPhiUsesWith()?</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>