diff options
author | Jay Foad <jay.foad@amd.com> | 2023-05-24 14:57:23 +0100 |
---|---|---|
committer | Jay Foad <jay.foad@amd.com> | 2023-06-01 19:17:34 +0100 |
commit | 5022fc2ad31b5e3211e2458347c89412b8c5ec1b (patch) | |
tree | 3ce4e7d2001a8552c457ae8a0ec1b58fc669f4ae /llvm/lib/CodeGen/MachineFunction.cpp | |
parent | 2de54b919ba5fd9ccf37038cddfc36e97eb480af (diff) | |
download | llvm-5022fc2ad31b5e3211e2458347c89412b8c5ec1b.zip llvm-5022fc2ad31b5e3211e2458347c89412b8c5ec1b.tar.gz llvm-5022fc2ad31b5e3211e2458347c89412b8c5ec1b.tar.bz2 |
[CodeGen] Make use of MachineInstr::all_defs and all_uses. NFCI.
Differential Revision: https://reviews.llvm.org/D151424
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineFunction.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index b33bb45..e1cf417 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -1082,8 +1082,8 @@ auto MachineFunction::salvageCopySSAImpl(MachineInstr &MI) if (State.first.isVirtual()) { // Virtual register def -- we can just look up where this happens. MachineInstr *Inst = MRI.def_begin(State.first)->getParent(); - for (auto &MO : Inst->operands()) { - if (!MO.isReg() || !MO.isDef() || MO.getReg() != State.first) + for (auto &MO : Inst->all_defs()) { + if (MO.getReg() != State.first) continue; return ApplySubregisters({Inst->getDebugInstrNum(), MO.getOperandNo()}); } @@ -1100,10 +1100,9 @@ auto MachineFunction::salvageCopySSAImpl(MachineInstr &MI) auto RMII = CurInst->getReverseIterator(); auto PrevInstrs = make_range(RMII, CurInst->getParent()->instr_rend()); for (auto &ToExamine : PrevInstrs) { - for (auto &MO : ToExamine.operands()) { + for (auto &MO : ToExamine.all_defs()) { // Test for operand that defines something aliasing RegToSeek. - if (!MO.isReg() || !MO.isDef() || - !TRI.regsOverlap(RegToSeek, MO.getReg())) + if (!TRI.regsOverlap(RegToSeek, MO.getReg())) continue; return ApplySubregisters( |