diff options
author | Manman Ren <mren@apple.com> | 2012-07-02 18:55:36 +0000 |
---|---|---|
committer | Manman Ren <mren@apple.com> | 2012-07-02 18:55:36 +0000 |
commit | 5f917cd3fada4507c0f4b718dd6af24b5e7086f1 (patch) | |
tree | 1c7130312ce7a92744826c2208d8247345edf990 /lib/CodeGen/TwoAddressInstructionPass.cpp | |
parent | 49589f0d0e35f643e697ab7ae8a51a530d38b0d8 (diff) | |
download | llvm-5f917cd3fada4507c0f4b718dd6af24b5e7086f1.tar.gz llvm-5f917cd3fada4507c0f4b718dd6af24b5e7086f1.tar.bz2 llvm-5f917cd3fada4507c0f4b718dd6af24b5e7086f1.tar.xz |
Added assertion in getVRegDef of MachineRegisterInfo to make sure the virtual
register does not have multiple definitions. Modified TwoAddressInstructionPass
to use getUniqueVRegDef instead of getVRegDef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159545 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TwoAddressInstructionPass.cpp')
-rw-r--r-- | lib/CodeGen/TwoAddressInstructionPass.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp index c87ab64ca8..153f8711d8 100644 --- a/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -1536,7 +1536,7 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) { // Emit a copy or rematerialize the definition. bool isCopy = false; const TargetRegisterClass *rc = MRI->getRegClass(regB); - MachineInstr *DefMI = MRI->getVRegDef(regB); + MachineInstr *DefMI = MRI->getUniqueVRegDef(regB); // If it's safe and profitable, remat the definition instead of // copying it. if (DefMI && @@ -1722,9 +1722,10 @@ TwoAddressInstructionPass::CoalesceExtSubRegs(SmallVector<unsigned,4> &Srcs, continue; // Check that the instructions are all in the same basic block. - MachineInstr *SrcDefMI = MRI->getVRegDef(SrcReg); - MachineInstr *DstDefMI = MRI->getVRegDef(DstReg); - if (SrcDefMI->getParent() != DstDefMI->getParent()) + MachineInstr *SrcDefMI = MRI->getUniqueVRegDef(SrcReg); + MachineInstr *DstDefMI = MRI->getUniqueVRegDef(DstReg); + if (!SrcDefMI || !DstDefMI || + SrcDefMI->getParent() != DstDefMI->getParent()) continue; // If there are no other uses than copies which feed into @@ -1874,7 +1875,7 @@ bool TwoAddressInstructionPass::EliminateRegSequences() { MachineInstr *DefMI = NULL; if (!MI->getOperand(i).getSubReg() && !TargetRegisterInfo::isPhysicalRegister(SrcReg)) { - DefMI = MRI->getVRegDef(SrcReg); + DefMI = MRI->getUniqueVRegDef(SrcReg); } if (DefMI && DefMI->isImplicitDef()) { |