diff options
Diffstat (limited to 'llvm/lib/CodeGen/TailDuplicator.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/TailDuplicator.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/TailDuplicator.cpp b/llvm/lib/CodeGen/TailDuplicator.cpp index bd554189f12b..575bf555c489 100644 --- a/llvm/lib/CodeGen/TailDuplicator.cpp +++ b/llvm/lib/CodeGen/TailDuplicator.cpp @@ -627,6 +627,14 @@ bool TailDuplicator::shouldTailDuplicate(bool IsSimple, if (PreRegAlloc && MI.isCall()) return false; + // TailDuplicator::appendCopies will erroneously place COPYs after + // INLINEASM_BR instructions after 4b0aa5724fea, which demonstrates the same + // bug that was fixed in f7a53d82c090. + // FIXME: Use findPHICopyInsertPoint() to find the correct insertion point + // for the COPY when replacing PHIs. + if (MI.getOpcode() == TargetOpcode::INLINEASM_BR) + return false; + if (MI.isBundle()) InstrCount += MI.getBundleSize(); else if (!MI.isPHI() && !MI.isMetaInstruction()) @@ -712,8 +720,7 @@ bool TailDuplicator::duplicateSimpleBB( SmallVectorImpl<MachineInstr *> &Copies) { SmallPtrSet<MachineBasicBlock *, 8> Succs(TailBB->succ_begin(), TailBB->succ_end()); - SmallVector<MachineBasicBlock *, 8> Preds(TailBB->pred_begin(), - TailBB->pred_end()); + SmallVector<MachineBasicBlock *, 8> Preds(TailBB->predecessors()); bool Changed = false; for (MachineBasicBlock *PredBB : Preds) { if (PredBB->hasEHPadSuccessor() || PredBB->mayHaveInlineAsmBr()) |
