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: unassignedb...@nondot.org
          Reporter: pauls...@linux.vnet.ibm.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to