mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
Fix PR7156. If the sources of a REG_SEQUENCE are all IMPLICIT_DEF's. Replace it with an IMPLICIT_DEF rather than deleting it or else it would be left without a def.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103984 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1238,6 +1238,7 @@ bool TwoAddressInstructionPass::EliminateRegSequences() {
|
||||
llvm_unreachable(0);
|
||||
}
|
||||
|
||||
bool IsImpDef = true;
|
||||
SmallVector<unsigned, 4> RealSrcs;
|
||||
SmallSet<unsigned, 4> Seen;
|
||||
for (unsigned i = 1, e = MI->getNumOperands(); i < e; i += 2) {
|
||||
@ -1253,6 +1254,7 @@ bool TwoAddressInstructionPass::EliminateRegSequences() {
|
||||
DefMI->eraseFromParent();
|
||||
continue;
|
||||
}
|
||||
IsImpDef = false;
|
||||
|
||||
// Remember EXTRACT_SUBREG sources. These might be candidate for
|
||||
// coalescing.
|
||||
@ -1297,8 +1299,15 @@ bool TwoAddressInstructionPass::EliminateRegSequences() {
|
||||
UpdateRegSequenceSrcs(SrcReg, DstReg, SubIdx, MRI);
|
||||
}
|
||||
|
||||
DEBUG(dbgs() << "Eliminated: " << *MI);
|
||||
MI->eraseFromParent();
|
||||
if (IsImpDef) {
|
||||
DEBUG(dbgs() << "Turned: " << *MI << " into an IMPLICIT_DEF");
|
||||
MI->setDesc(TII->get(TargetOpcode::IMPLICIT_DEF));
|
||||
for (int j = MI->getNumOperands() - 1, ee = 0; j > ee; --j)
|
||||
MI->RemoveOperand(j);
|
||||
} else {
|
||||
DEBUG(dbgs() << "Eliminated: " << *MI);
|
||||
MI->eraseFromParent();
|
||||
}
|
||||
|
||||
// Try coalescing some EXTRACT_SUBREG instructions.
|
||||
CoalesceExtSubRegs(RealSrcs, DstReg);
|
||||
|
Reference in New Issue
Block a user