[llvm] 1a315dc - CodeGen: Use getVRegDef in salvageCopySSAImpl (#219518)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 28 10:11:30 PDT 2026
Author: Matt Arsenault
Date: 2026-08-28T17:11:25Z
New Revision: 1a315dc409bd5eec1c4df57ae9225b518c1c265a
URL: https://github.com/llvm/llvm-project/commit/1a315dc409bd5eec1c4df57ae9225b518c1c265a
DIFF: https://github.com/llvm/llvm-project/commit/1a315dc409bd5eec1c4df57ae9225b518c1c265a.diff
LOG: CodeGen: Use getVRegDef in salvageCopySSAImpl (#219518)
Added:
Modified:
llvm/lib/CodeGen/MachineFunction.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index 144f165e17973..05b47698fb7ff 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -1200,14 +1200,14 @@ auto MachineFunction::salvageCopySSAImpl(MachineInstr &MI)
if (State.second)
SubregsSeen.push_back(State.second);
- assert(MRI.hasOneDef(State.first));
- MachineInstr &Inst = *MRI.def_begin(State.first)->getParent();
- CurInst = Inst.getIterator();
+ MachineInstr *Inst = MRI.getVRegDef(State.first);
+ assert(Inst && "Virtual register has no def");
+ CurInst = Inst->getIterator();
// Any non-copy instruction is the defining instruction we're seeking.
- if (!Inst.isCopyLike() && !TII.isCopyLikeInstr(Inst))
+ if (!Inst->isCopyLike() && !TII.isCopyLikeInstr(*Inst))
break;
- State = GetRegAndSubreg(Inst);
+ State = GetRegAndSubreg(*Inst);
};
// Helper lambda to apply additional subregister substitutions to a known
@@ -1233,7 +1233,7 @@ auto MachineFunction::salvageCopySSAImpl(MachineInstr &MI)
// instruction / operand pair after adding subregister qualifiers.
if (State.first.isVirtual()) {
// Virtual register def -- we can just look up where this happens.
- MachineInstr *Inst = MRI.def_begin(State.first)->getParent();
+ MachineInstr *Inst = MRI.getVRegDef(State.first);
for (auto &MO : Inst->all_defs()) {
if (MO.getReg() != State.first)
continue;
More information about the llvm-commits
mailing list