Skip to content

[CodeGen][NPM] VirtRegRewriter: Set VirtReg flag #148107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2025

Conversation

vikramRH
Copy link
Contributor

@vikramRH vikramRH commented Jul 11, 2025

same as #138660,

Co-authored-by : Oke, Akshat <[email protected]>

@llvmbot
Copy link
Member

llvmbot commented Jul 11, 2025

@llvm/pr-subscribers-llvm-regalloc

Author: Vikram Hegde (vikramRH)

Changes

same as #138660,

Authored by @optimisan


Full diff: https://github.com/llvm/llvm-project/pull/148107.diff

2 Files Affected:

  • (modified) llvm/include/llvm/CodeGen/VirtRegMap.h (+8)
  • (modified) llvm/lib/CodeGen/VirtRegMap.cpp (+2)
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);

Base automatically changed from users/vikramRH/npm_pending/reg_wait_sgpr to main July 14, 2025 04:57
@vikramRH vikramRH force-pushed the users/vikramRH/npm_pending/set-vrr branch from a7b5f3a to 90c6b46 Compare July 14, 2025 06:12
@vikramRH vikramRH merged commit e091f26 into main Jul 14, 2025
9 checks passed
@vikramRH vikramRH deleted the users/vikramRH/npm_pending/set-vrr branch July 14, 2025 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants