From 4b0aa5724feaa89a9538dcab97e018110b0e4bc3 Mon Sep 17 00:00:00 2001 From: James Y Knight Date: Fri, 15 May 2020 23:43:30 -0400 Subject: Change the INLINEASM_BR MachineInstr to be a non-terminating instruction. Before this instruction supported output values, it fit fairly naturally as a terminator. However, being a terminator while also supporting outputs causes some trouble, as the physreg->vreg COPY operations cannot be in the same block. Modeling it as a non-terminator allows it to be handled the same way as invoke is handled already. Most of the changes here were created by auditing all the existing users of MachineBasicBlock::isEHPad() and MachineBasicBlock::hasEHPadSuccessor(), and adding calls to isInlineAsmBrIndirectTarget or mayHaveInlineAsmBr, as appropriate. Reviewed By: nickdesaulniers, void Differential Revision: https://reviews.llvm.org/D79794 --- llvm/lib/CodeGen/MachineBasicBlock.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp') diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index e848741..2d4b604 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -277,8 +277,16 @@ LLVM_DUMP_METHOD void MachineBasicBlock::dump() const { } #endif +bool MachineBasicBlock::mayHaveInlineAsmBr() const { + for (const MachineBasicBlock *Succ : successors()) { + if (Succ->isInlineAsmBrIndirectTarget()) + return true; + } + return false; +} + bool MachineBasicBlock::isLegalToHoistInto() const { - if (isReturnBlock() || hasEHPadSuccessor()) + if (isReturnBlock() || hasEHPadSuccessor() || mayHaveInlineAsmBr()) return false; return true; } @@ -1132,7 +1140,7 @@ bool MachineBasicBlock::canSplitCriticalEdge( // Splitting the critical edge to a callbr's indirect block isn't advised. // Don't do it in this generic function. - if (isInlineAsmBrIndirectTarget(Succ)) + if (Succ->isInlineAsmBrIndirectTarget()) return false; const MachineFunction *MF = getParent(); -- cgit v1.1