[llvm] Try to derive registerinfo if registerinfo is null (PR #82651)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 22 08:45:15 PST 2024
https://github.com/AtariDreams created https://github.com/llvm/llvm-project/pull/82651
None
>From ebd0a592513bcd711d3c21e086025e5af1c09909 Mon Sep 17 00:00:00 2001
From: Rose <83477269+AtariDreams at users.noreply.github.com>
Date: Thu, 22 Feb 2024 11:44:43 -0500
Subject: [PATCH] Try to derive registerinfo if registerinfo is null
---
llvm/lib/CodeGen/MachineInstr.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index efbcc839f22d0c..ecb482687dbb00 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -1063,6 +1063,8 @@ int
MachineInstr::findRegisterDefOperandIdx(Register Reg, bool isDead, bool Overlap,
const TargetRegisterInfo *TRI) const {
bool isPhys = Reg.isPhysical();
+ if (!TRI)
+ TRI = getParent() ? getMF()->getSubtarget().getRegisterInfo() : nullptr;
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
const MachineOperand &MO = getOperand(i);
// Accept regmask operands when Overlap is set.
@@ -1073,6 +1075,7 @@ MachineInstr::findRegisterDefOperandIdx(Register Reg, bool isDead, bool Overlap,
continue;
Register MOReg = MO.getReg();
bool Found = (MOReg == Reg);
+
if (!Found && TRI && isPhys && MOReg.isPhysical()) {
if (Overlap)
Found = TRI->regsOverlap(MOReg, Reg);
More information about the llvm-commits
mailing list