diff options
author | Evan Cheng <evan.cheng@apple.com> | 2010-05-17 22:09:49 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2010-05-17 22:09:49 +0000 |
commit | 44bfdd3d78d32bb8fcd5ad123199246e554306d8 (patch) | |
tree | 95184f64574cbbf13ce576c04056a51e3c504e07 /lib/CodeGen/TwoAddressInstructionPass.cpp | |
parent | 47006be498e256cc8c356a2325c918b825ab2ab7 (diff) |
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
Diffstat (limited to 'lib/CodeGen/TwoAddressInstructionPass.cpp')
-rw-r--r-- | lib/CodeGen/TwoAddressInstructionPass.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp index fb9bddca25..2d43fba4bf 100644 --- a/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -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); |