[llvm-branch-commits] [llvm] [MIR] Add missing noteNewVirtualRegister callbacks (PR #111634)

Akshat Oke via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Oct 8 22:57:59 PDT 2024


https://github.com/Akshat-Oke created https://github.com/llvm/llvm-project/pull/111634

None

>From 2b877142d7a9346033d02e5a977d2dcaa440258c Mon Sep 17 00:00:00 2001
From: Akshat Oke <Akshat.Oke at amd.com>
Date: Wed, 9 Oct 2024 05:01:22 +0000
Subject: [PATCH] [MIR] Add missing noteNewVirtualRegister callbacks

---
 llvm/lib/CodeGen/MIRParser/MIParser.cpp  | 1 +
 llvm/lib/CodeGen/MIRParser/MIRParser.cpp | 9 +++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
index f1d3ce9a563406..7aaa0f409d5ef9 100644
--- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
@@ -1786,6 +1786,7 @@ bool MIParser::parseRegisterOperand(MachineOperand &Dest,
 
         MRI.setRegClassOrRegBank(Reg, static_cast<RegisterBank *>(nullptr));
         MRI.setType(Reg, Ty);
+        MRI.noteNewVirtualRegister(Reg);
       }
     }
   } else if (consumeIfPresent(MIToken::lparen)) {
diff --git a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp
index 0c8a3eb6c2d83d..f10a480f7e6160 100644
--- a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp
@@ -652,10 +652,10 @@ MIRParserImpl::initializeMachineFunction(const yaml::MachineFunction &YamlMF,
 bool MIRParserImpl::parseRegisterInfo(PerFunctionMIParsingState &PFS,
                                       const yaml::MachineFunction &YamlMF) {
   MachineFunction &MF = PFS.MF;
-  MachineRegisterInfo &RegInfo = MF.getRegInfo();
+  MachineRegisterInfo &MRI = MF.getRegInfo();
   assert(RegInfo.tracksLiveness());
   if (!YamlMF.TracksRegLiveness)
-    RegInfo.invalidateLiveness();
+    MRI.invalidateLiveness();
 
   SMDiagnostic Error;
   // Parse the virtual register information.
@@ -705,6 +705,7 @@ bool MIRParserImpl::parseRegisterInfo(PerFunctionMIParsingState &PFS,
                          FlagStringValue.Value + "'");
       Info.Flags.push_back(FlagValue);
     }
+    MRI.noteNewVirtualRegister(Info.VReg);
   }
 
   // Parse the liveins.
@@ -720,7 +721,7 @@ bool MIRParserImpl::parseRegisterInfo(PerFunctionMIParsingState &PFS,
         return error(Error, LiveIn.VirtualRegister.SourceRange);
       VReg = Info->VReg;
     }
-    RegInfo.addLiveIn(Reg, VReg);
+    MRI.addLiveIn(Reg, VReg);
   }
 
   // Parse the callee saved registers (Registers that will
@@ -733,7 +734,7 @@ bool MIRParserImpl::parseRegisterInfo(PerFunctionMIParsingState &PFS,
         return error(Error, RegSource.SourceRange);
       CalleeSavedRegisters.push_back(Reg);
     }
-    RegInfo.setCalleeSavedRegs(CalleeSavedRegisters);
+    MRI.setCalleeSavedRegs(CalleeSavedRegisters);
   }
 
   return false;



More information about the llvm-branch-commits mailing list