[llvm] [PHIElimination] Ensure correct copy emission for `INLINEASM_BR` indirect targets (PR #173396)

Nick Desaulniers via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 8 07:32:40 PST 2026


nickdesaulniers wrote:

INLINEASM_BR is not a Terminator

On Thu, Jan 8, 2026, 7:09 AM Matt Arsenault ***@***.***>
wrote:

> ***@***.**** commented on this pull request.
> ------------------------------
>
> In llvm/lib/CodeGen/PHIEliminationUtils.cpp
> <https://github.com/llvm/llvm-project/pull/173396#discussion_r2672734679>:
>
> > @@ -13,6 +13,19 @@
>
>  using namespace llvm;
>
> +// Returns true if MBB contains an INLINEASM_BR instruction that may
> +// branch to SuccMBB, requiring specialized copy placement.
> +static bool hasInlineAsmBrToSuccessor(MachineBasicBlock *MBB,
> +                                      MachineBasicBlock *SuccMBB) {
> +  if (!SuccMBB->isInlineAsmBrIndirectTarget())
> +    return false;
> +
> +  for (const MachineInstr &MI : *MBB)
> +    if (MI.getOpcode() == TargetOpcode::INLINEASM_BR)
> +      return true;
>
> It is illegal for non-terminators to follow terminators. There cannot be
> any instructions between the INLINEASM_BR and the end oft he block
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/llvm/llvm-project/pull/173396#discussion_r2672734679>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAN5IX5OOEPILIYRXS2GWGD4FZXK7AVCNFSM6AAAAACP3WMHXKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTMMZZHA3DGNJQGQ>
> .
> You are receiving this because your review was requested.Message ID:
> ***@***.***>
>


https://github.com/llvm/llvm-project/pull/173396


More information about the llvm-commits mailing list