[llvm] Try to derive registerinfo if registerinfo is null (PR #82651)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 08:46:10 PST 2024


https://github.com/AtariDreams updated https://github.com/llvm/llvm-project/pull/82651

>From 1321f5aa0a88565871c3b291ff62b849dbad85d3 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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index efbcc839f22d0c..d5188b69dcc47f 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.



More information about the llvm-commits mailing list