[llvm] 85c141a - NVPTX: Drop LiveVariables from the register allocation pipeline (#225183)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 08:57:30 PDT 2026


Author: Matt Arsenault
Date: 2026-10-01T17:57:22+02:00
New Revision: 85c141a162683301e1250142ffd1a1c20c5df7e2

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

LOG: NVPTX: Drop LiveVariables from the register allocation pipeline (#225183)

The optimized RegAlloc pipeline ran LiveVariables only to satisfy 
PHIElimination and TwoAddressInstruction, both of which no longer need it. 
Remove the LiveVariables run (and, in the new pass manager, the 
UnreachableMachineBlockElim that was there only as a LiveVariables 
prerequisite).

Co-authored-by: Claude (Claude-Opus-4.8)

Added: 
    

Modified: 
    llvm/lib/Target/NVPTX/NVPTXCodeGenPassBuilder.cpp
    llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
    llvm/test/CodeGen/NVPTX/llc-pipeline-npm.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/NVPTX/NVPTXCodeGenPassBuilder.cpp b/llvm/lib/Target/NVPTX/NVPTXCodeGenPassBuilder.cpp
index d48b8f6f5fdc5..c23269e17631a 100644
--- a/llvm/lib/Target/NVPTX/NVPTXCodeGenPassBuilder.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXCodeGenPassBuilder.cpp
@@ -19,7 +19,6 @@
 #include "llvm/Analysis/KernelInfo.h"
 #include "llvm/CodeGen/AtomicExpand.h"
 #include "llvm/CodeGen/FuncletLayout.h"
-#include "llvm/CodeGen/LiveVariables.h"
 #include "llvm/CodeGen/MachineCopyPropagation.h"
 #include "llvm/CodeGen/MachineLateInstrsCleanup.h"
 #include "llvm/CodeGen/MachineLoopInfo.h"
@@ -280,12 +279,6 @@ Error NVPTXCodeGenPassBuilder::addFastRegAlloc(PassManagerWrapper &PMW) {
 
 Error NVPTXCodeGenPassBuilder::addOptimizedRegAlloc(PassManagerWrapper &PMW) {
   addMachineFunctionPass(ProcessImplicitDefsPass(), PMW);
-  // LiveVariables requires pure SSA form and no unreachable blocks; the legacy
-  // pass manager pulls UnreachableMachineBlockElim in as an implicit
-  // dependency, so add it explicitly here.
-  addMachineFunctionPass(UnreachableMachineBlockElimPass(), PMW);
-  addMachineFunctionPass(
-      RequireAnalysisPass<LiveVariablesAnalysis, MachineFunction>(), PMW);
   addMachineFunctionPass(
       RequireAnalysisPass<MachineLoopAnalysis, MachineFunction>(), PMW);
   addMachineFunctionPass(PHIEliminationPass(), PMW);

diff  --git a/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp b/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
index 89e69c403db87..df3d492c9fbab 100644
--- a/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
@@ -364,7 +364,6 @@ void NVPTXPassConfig::addFastRegAlloc() {
 
 void NVPTXPassConfig::addOptimizedRegAlloc() {
   addPass(&ProcessImplicitDefsID);
-  addPass(&LiveVariablesID);
   addPass(&MachineLoopInfoID);
   addPass(&PHIEliminationID);
 

diff  --git a/llvm/test/CodeGen/NVPTX/llc-pipeline-npm.ll b/llvm/test/CodeGen/NVPTX/llc-pipeline-npm.ll
index 697c73d5ffde4..dbb5ceba181e5 100644
--- a/llvm/test/CodeGen/NVPTX/llc-pipeline-npm.ll
+++ b/llvm/test/CodeGen/NVPTX/llc-pipeline-npm.ll
@@ -148,8 +148,6 @@
 ; O2-NEXT:     nvptx-address-folder
 ; O2-NEXT:     nvptx-proxyreg-erasure
 ; O2-NEXT:     process-imp-defs
-; O2-NEXT:     unreachable-mbb-elimination
-; O2-NEXT:     require<live-vars>
 ; O2-NEXT:     require<machine-loops>
 ; O2-NEXT:     phi-node-elimination
 ; O2-NEXT:     two-address-instruction


        


More information about the llvm-commits mailing list