diff --git a/llvm/lib/CodeGen/TailDuplicator.cpp b/llvm/lib/CodeGen/TailDuplicator.cpp --- a/llvm/lib/CodeGen/TailDuplicator.cpp +++ b/llvm/lib/CodeGen/TailDuplicator.cpp @@ -627,6 +627,14 @@ if (PreRegAlloc && MI.isCall()) return false; + // Copying a block with an INLINEASM_BR instruction may result in a PHI node + // on the indirect path. We assume that all values used on the indirect path + // dominates all paths into the indirect block, i.e. don't have PHI nodes. + // FIXME: This may be too restrictive. Perhaps should restrict only if a + // value in the current block isn't used on the indirect path. + if (MI.getOpcode() == TargetOpcode::INLINEASM_BR) + return false; + if (MI.isBundle()) InstrCount += MI.getBundleSize(); else if (!MI.isPHI() && !MI.isMetaInstruction())