Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions llvm/lib/CodeGen/TailDuplicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,16 @@ void TailDuplicator::processPHI(
MI->eraseFromParent();
else if (MI->getNumOperands() == 1)
MI->setDesc(TII->get(TargetOpcode::IMPLICIT_DEF));
else if (TailBB->pred_size() == 2) {
// According to callers implementation, PredBB has not yet been removed from
// TailBB predecessors list. After removal TailBB will have the only one
// predecessor and all phi instructions should be replaced with copies.
assert(PredBB->isSuccessor(TailBB));
BuildMI(*TailBB, MI->getIterator(), MI->getDebugLoc(),
TII->get(TargetOpcode::COPY), MI->getOperand(0).getReg())
.add(MI->getOperand(1));
MI->eraseFromParent();
}
}

/// Duplicate a TailBB instruction to PredBB and update
Expand Down
Loading