[llvm] e091f26 - [CodeGen][NPM] VirtRegRewriter: Set VirtReg flag (#148107)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 01:06:15 PDT 2025


Author: Vikram Hegde
Date: 2025-07-14T13:36:12+05:30
New Revision: e091f264b7e4d4aeaf5c569e6251d462395ad702

URL: https://github.com/llvm/llvm-project/commit/e091f264b7e4d4aeaf5c569e6251d462395ad702
DIFF: https://github.com/llvm/llvm-project/commit/e091f264b7e4d4aeaf5c569e6251d462395ad702.diff

LOG: [CodeGen][NPM] VirtRegRewriter: Set VirtReg flag (#148107)

same as https://github.com/llvm/llvm-project/pull/138660,

Co-authored-by : Oke, Akshat
<[Akshat.Oke at amd.com](mailto:Akshat.Oke at amd.com)>

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/VirtRegMap.h
    llvm/lib/CodeGen/VirtRegMap.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/VirtRegMap.h b/llvm/include/llvm/CodeGen/VirtRegMap.h
index 5ab3f7e742230..b5f962e0fb821 100644
--- a/llvm/include/llvm/CodeGen/VirtRegMap.h
+++ b/llvm/include/llvm/CodeGen/VirtRegMap.h
@@ -251,6 +251,14 @@ class VirtRegRewriterPass : public PassInfoMixin<VirtRegRewriterPass> {
 
   LLVM_ABI void printPipeline(raw_ostream &OS,
                               function_ref<StringRef(StringRef)>) const;
+
+  MachineFunctionProperties getSetProperties() const {
+    if (ClearVirtRegs) {
+      return MachineFunctionProperties().set(
+          MachineFunctionProperties::Property::NoVRegs);
+    }
+    return {};
+  }
 };
 
 } // end llvm namespace

diff  --git a/llvm/lib/CodeGen/VirtRegMap.cpp b/llvm/lib/CodeGen/VirtRegMap.cpp
index 3d6ccba894e9c..99ba893d6f096 100644
--- a/llvm/lib/CodeGen/VirtRegMap.cpp
+++ b/llvm/lib/CodeGen/VirtRegMap.cpp
@@ -301,6 +301,8 @@ bool VirtRegRewriterLegacy::runOnMachineFunction(MachineFunction &MF) {
 PreservedAnalyses
 VirtRegRewriterPass::run(MachineFunction &MF,
                          MachineFunctionAnalysisManager &MFAM) {
+  MFPropsModifier _(*this, MF);
+
   VirtRegMap &VRM = MFAM.getResult<VirtRegMapAnalysis>(MF);
   LiveIntervals &LIS = MFAM.getResult<LiveIntervalsAnalysis>(MF);
   LiveRegMatrix &LRM = MFAM.getResult<LiveRegMatrixAnalysis>(MF);


        


More information about the llvm-commits mailing list