[llvm] Try to derive registerinfo if registerinfo is null (PR #82651)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 22 09:36:39 PST 2024
https://github.com/AtariDreams updated https://github.com/llvm/llvm-project/pull/82651
>From 3ce6ce3ee6c0e2c3c0cbbd64f82282c9955ad35a 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 nullptr
---
llvm/lib/CodeGen/MachineInstr.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index efbcc839f22d0c..3cd6c5c11c824c 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -1013,6 +1013,8 @@ bool MachineInstr::hasRegisterImplicitUseOperand(Register Reg) const {
/// the search criteria to a use that kills the register if isKill is true.
int MachineInstr::findRegisterUseOperandIdx(
Register Reg, bool isKill, const TargetRegisterInfo *TRI) const {
+ if (!TRI)
+ TRI = getParent() ? getMF()->getSubtarget().getRegisterInfo() : nullptr;
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
const MachineOperand &MO = getOperand(i);
if (!MO.isReg() || !MO.isUse())
@@ -1063,6 +1065,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.
More information about the llvm-commits
mailing list