aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/TwoAddressInstructionPass.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-03-03 21:18:38 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-03-03 21:18:38 +0000
commit1423c70b8f1b1a757c640fac9a17cb015012e8e9 (patch)
treefded141d85e944a3c236f9f45594ddc6b5d7e998 /lib/CodeGen/TwoAddressInstructionPass.cpp
parent14c85cbf541ec8940127474c20d8f1b5d5706bfe (diff)
Add MachineRegisterInfo::hasOneUse and hasOneNonDBGUse.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97663 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TwoAddressInstructionPass.cpp')
-rw-r--r--lib/CodeGen/TwoAddressInstructionPass.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp
index 0ba38433c2..c840b3968c 100644
--- a/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -454,13 +454,10 @@ MachineInstr *findOnlyInterestingUse(unsigned Reg, MachineBasicBlock *MBB,
const TargetInstrInfo *TII,
bool &IsCopy,
unsigned &DstReg, bool &IsDstPhys) {
- MachineRegisterInfo::use_nodbg_iterator UI = MRI->use_nodbg_begin(Reg);
- if (UI == MRI->use_nodbg_end())
- return 0;
- MachineInstr &UseMI = *UI;
- if (++UI != MRI->use_nodbg_end())
- // More than one use.
+ if (!MRI->hasOneNonDBGUse(Reg))
+ // None or more than one use.
return 0;
+ MachineInstr &UseMI = *MRI->use_nodbg_begin(Reg);
if (UseMI.getParent() != MBB)
return 0;
unsigned SrcReg;