[llvm-branch-commits] [llvm] NVPTX: Drop LiveVariables from the register allocation pipeline (PR #225183)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Sep 28 00:01:08 PDT 2026


https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/225183

>From 42477f21cf74d45778c47d09b6770460898464bf Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Wed, 9 Sep 2026 21:35:39 +0200
Subject: [PATCH] NVPTX: Drop LiveVariables from the register allocation
 pipeline

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)
---
 llvm/lib/Target/NVPTX/NVPTXCodeGenPassBuilder.cpp | 7 -------
 llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp      | 1 -
 llvm/test/CodeGen/NVPTX/llc-pipeline-npm.ll       | 2 --
 3 files changed, 10 deletions(-)

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-branch-commits mailing list