[llvm] [CodeGen][NPM] VirtRegRewriter: Set VirtReg flag (PR #148107)
Vikram Hegde via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 13 23:12:06 PDT 2025
https://github.com/vikramRH updated https://github.com/llvm/llvm-project/pull/148107
>From 90c6b461174aa5d6d5e9b8781c7972eca02e01cd Mon Sep 17 00:00:00 2001
From: vikhegde <vikram.hegde at amd.com>
Date: Thu, 10 Jul 2025 15:25:03 +0530
Subject: [PATCH] [CodeGen][NPM] VirtRegRewriter: Set VirtReg flag
---
llvm/include/llvm/CodeGen/VirtRegMap.h | 8 ++++++++
llvm/lib/CodeGen/VirtRegMap.cpp | 2 ++
2 files changed, 10 insertions(+)
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