[llvm-bugs] [Bug 45062] New: [SimplifyCFGPass] mergeEmptyReturnBlocks() leaves broken callbr (asm goto) instruction.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 28 11:31:22 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=45062

            Bug ID: 45062
           Summary: [SimplifyCFGPass]  mergeEmptyReturnBlocks() leaves
                    broken callbr (asm goto) instruction.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: paulsson at linux.vnet.ibm.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 23188
  --> https://bugs.llvm.org/attachment.cgi?id=23188&action=edit
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()?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200228/f0e58fe2/attachment.html>


More information about the llvm-bugs mailing list