[llvm-branch-commits] [llvm] cab4c59 - Revert "[SPIR-V] Default to NewPM (#239489)"

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Nov 22 19:46:42 PST 2026


Author: Aiden Grossman
Date: 2026-11-22T19:46:38-08:00
New Revision: cab4c594a6bd54a699b1e96786988d88f51a35fd

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

LOG: Revert "[SPIR-V] Default to NewPM (#239489)"

This reverts commit e7541913f021f46a4e1d24452d47d5b4c019308f.

Added: 
    

Modified: 
    llvm/lib/Target/SPIRV/SPIRVTargetMachine.h
    llvm/test/CodeGen/SPIRV/debug-info/debug-declare.ll
    llvm/test/CodeGen/SPIRV/debug-info/debug-value-constant.ll
    llvm/test/CodeGen/SPIRV/debug-info/debug-value.ll
    llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_float_controls2/decoration.ll
    llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveActiveAnyTrue.ll
    llvm/test/CodeGen/SPIRV/instructions/undef-composite.ll
    llvm/test/CodeGen/SPIRV/llc-pipeline.ll
    llvm/test/CodeGen/SPIRV/loop-unroll-nonshader.ll
    llvm/test/CodeGen/SPIRV/pointers/global-vars-untyped.ll
    llvm/test/CodeGen/SPIRV/structurizer/cf.while.continue.ll
    llvm/test/CodeGen/SPIRV/structurizer/do-continue.ll
    llvm/test/CodeGen/SPIRV/transcoding/NoSignedUnsignedWrap.ll
    llvm/unittests/Target/SPIRV/SPIRVAPITest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SPIRV/SPIRVTargetMachine.h b/llvm/lib/Target/SPIRV/SPIRVTargetMachine.h
index bc90b1071acb0c..4169ec63ae13d8 100644
--- a/llvm/lib/Target/SPIRV/SPIRVTargetMachine.h
+++ b/llvm/lib/Target/SPIRV/SPIRVTargetMachine.h
@@ -57,8 +57,6 @@ class SPIRVTargetMachine : public CodeGenTargetMachineImpl {
                              CodeGenFileType FileType,
                              const CGPassBuilderOption &Opt, MCContext &Ctx,
                              PassInstrumentationCallbacks *PIC) override;
-
-  bool shouldDefaultToNewPM() const override { return true; }
 };
 } // namespace llvm
 

diff  --git a/llvm/test/CodeGen/SPIRV/debug-info/debug-declare.ll b/llvm/test/CodeGen/SPIRV/debug-info/debug-declare.ll
index 0cb25fc35f9585..a766a46598c86b 100644
--- a/llvm/test/CodeGen/SPIRV/debug-info/debug-declare.ll
+++ b/llvm/test/CodeGen/SPIRV/debug-info/debug-declare.ll
@@ -1,4 +1,5 @@
 ; RUN: llc --verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_KHR_non_semantic_info %s -o - | FileCheck %s --implicit-check-not=DebugValue
+; RUN: llc -enable-new-pm --verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_KHR_non_semantic_info %s -o - | FileCheck %s --implicit-check-not=DebugValue
 ; RUN: %if spirv-tools %{ llc --verify-machineinstrs --spirv-ext=+SPV_KHR_non_semantic_info -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
 
 ; A #dbg_declare on an alloca that survives to MIR: the parameter copy and a

diff  --git a/llvm/test/CodeGen/SPIRV/debug-info/debug-value-constant.ll b/llvm/test/CodeGen/SPIRV/debug-info/debug-value-constant.ll
index 1574c253d01d0f..79a3e6c1f4c62b 100644
--- a/llvm/test/CodeGen/SPIRV/debug-info/debug-value-constant.ll
+++ b/llvm/test/CodeGen/SPIRV/debug-info/debug-value-constant.ll
@@ -1,4 +1,5 @@
 ; RUN: llc --verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --asm-verbose=0 --spirv-ext=+SPV_KHR_non_semantic_info %s -o - | FileCheck %s --implicit-check-not="OpCapability Int8" --implicit-check-not="OpCapability Int16" --implicit-check-not="OpCapability Int64" --implicit-check-not="OpCapability Float16" --implicit-check-not="OpCapability Float64"
+; RUN: llc -enable-new-pm --verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --asm-verbose=0 --spirv-ext=+SPV_KHR_non_semantic_info %s -o - | FileCheck %s --implicit-check-not="OpCapability Int8" --implicit-check-not="OpCapability Int16" --implicit-check-not="OpCapability Int64" --implicit-check-not="OpCapability Float16" --implicit-check-not="OpCapability Float64"
 ; RUN: llc --verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --asm-verbose=0 --spirv-ext=+SPV_KHR_non_semantic_info %s -o - | FileCheck %s --check-prefix=UNIQUE
 ; RUN: llc --verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --asm-verbose=0 --spirv-ext=+SPV_KHR_non_semantic_info %s -o - | FileCheck %s --check-prefix=DROPPED
 ; RUN: llc --verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --asm-verbose=0 --spirv-ext=+SPV_KHR_non_semantic_info %s -o - | FileCheck %s --check-prefix=DEDUP

diff  --git a/llvm/test/CodeGen/SPIRV/debug-info/debug-value.ll b/llvm/test/CodeGen/SPIRV/debug-info/debug-value.ll
index ab2a233a20b7c0..56c505e79f9650 100644
--- a/llvm/test/CodeGen/SPIRV/debug-info/debug-value.ll
+++ b/llvm/test/CodeGen/SPIRV/debug-info/debug-value.ll
@@ -1,6 +1,7 @@
 ; asm-verbose=0 keeps AsmPrinter's ;DEBUG_VALUE: comments out of the output so
 ; the CHECK-NEXT chains track SPIR-V instructions only.
 ; RUN: llc --verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --asm-verbose=0 --spirv-ext=+SPV_KHR_non_semantic_info %s -o - | FileCheck %s --implicit-check-not=DebugDeclare
+; RUN: llc -enable-new-pm --verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --asm-verbose=0 --spirv-ext=+SPV_KHR_non_semantic_info %s -o - | FileCheck %s --implicit-check-not=DebugDeclare
 ; RUN: %if spirv-tools %{ llc --verify-machineinstrs --spirv-ext=+SPV_KHR_non_semantic_info -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
 
 ; A direct DBG_VALUE whose virtual register is defined by an emitted SPIR-V

diff  --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_float_controls2/decoration.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_float_controls2/decoration.ll
index d9a40ac266d352..2b6e2cd7eb5942 100644
--- a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_float_controls2/decoration.ll
+++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_float_controls2/decoration.ll
@@ -1,4 +1,5 @@
 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_KHR_float_controls2 %s -o - | FileCheck %s
+; RUN: llc -enable-new-pm -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_KHR_float_controls2 %s -o - | FileCheck %s
 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_KHR_float_controls2 %s -o - -filetype=obj | spirv-val %}
 
 ; CHECK-DAG: Capability FloatControls2

diff  --git a/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveActiveAnyTrue.ll b/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveActiveAnyTrue.ll
index 88a0c88c99bf16..511ed5c1acf90c 100644
--- a/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveActiveAnyTrue.ll
+++ b/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveActiveAnyTrue.ll
@@ -1,5 +1,7 @@
 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
+; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown -enable-new-pm %s -o - | FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown -enable-new-pm %s -o - -filetype=obj | spirv-val %}
 
 ; CHECK-DAG: %[[#bool:]] = OpTypeBool
 ; CHECK-DAG: %[[#uint:]] = OpTypeInt 32 0

diff  --git a/llvm/test/CodeGen/SPIRV/instructions/undef-composite.ll b/llvm/test/CodeGen/SPIRV/instructions/undef-composite.ll
index 4defc5a8d96363..9df2c895070d7b 100644
--- a/llvm/test/CodeGen/SPIRV/instructions/undef-composite.ll
+++ b/llvm/test/CodeGen/SPIRV/instructions/undef-composite.ll
@@ -1,5 +1,7 @@
 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
+; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown -enable-new-pm %s -o - | FileCheck %s
 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown -enable-new-pm %s -o - -filetype=obj | spirv-val %}
 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-vulkan-unknown %s -o - | FileCheck %s
 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-vulkan-unknown %s -o - -filetype=obj | spirv-val %}
 

diff  --git a/llvm/test/CodeGen/SPIRV/llc-pipeline.ll b/llvm/test/CodeGen/SPIRV/llc-pipeline.ll
index 32397a50161413..ebf6ec7418fcbb 100644
--- a/llvm/test/CodeGen/SPIRV/llc-pipeline.ll
+++ b/llvm/test/CodeGen/SPIRV/llc-pipeline.ll
@@ -1,11 +1,11 @@
 ; UNSUPPORTED:expensive_checks
-; RUN:llc -O0 -mtriple=spirv-- -enable-new-pm=false -disable-verify -debug-pass=Structure < %s 2>&1 \
+; RUN:llc -O0 -mtriple=spirv-- -disable-verify -debug-pass=Structure < %s 2>&1 \
 ; RUN:   | FileCheck -match-full-lines -strict-whitespace -check-prefix=SPIRV-O0 %s
-; RUN:llc -O1 -mtriple=spirv-- -enable-new-pm=false -disable-verify -debug-pass=Structure < %s 2>&1 \
+; RUN:llc -O1 -mtriple=spirv-- -disable-verify -debug-pass=Structure < %s 2>&1 \
 ; RUN:   | FileCheck -match-full-lines -strict-whitespace -check-prefix=SPIRV-Opt %s
-; RUN:llc -O2 -mtriple=spirv-- -enable-new-pm=false -disable-verify -debug-pass=Structure < %s 2>&1 \
+; RUN:llc -O2 -mtriple=spirv-- -disable-verify -debug-pass=Structure < %s 2>&1 \
 ; RUN:   | FileCheck -match-full-lines -strict-whitespace -check-prefix=SPIRV-Opt %s
-; RUN:llc -O3 -mtriple=spirv-- -enable-new-pm=false -disable-verify -debug-pass=Structure < %s 2>&1 \
+; RUN:llc -O3 -mtriple=spirv-- -disable-verify -debug-pass=Structure < %s 2>&1 \
 ; RUN:   | FileCheck -match-full-lines -strict-whitespace -check-prefix=SPIRV-Opt %s
 ; RUN:llc -O0 -mtriple=spirv-- -enable-new-pm < %s \
 ; RUN:   | FileCheck -check-prefix=SPIRV-NPM %s

diff  --git a/llvm/test/CodeGen/SPIRV/loop-unroll-nonshader.ll b/llvm/test/CodeGen/SPIRV/loop-unroll-nonshader.ll
index d5f8eaefd7505a..a865bffea60637 100644
--- a/llvm/test/CodeGen/SPIRV/loop-unroll-nonshader.ll
+++ b/llvm/test/CodeGen/SPIRV/loop-unroll-nonshader.ll
@@ -1,5 +1,7 @@
 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
+; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown -enable-new-pm %s -o - | FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown -enable-new-pm %s -o - -filetype=obj | spirv-val %}
 
 ; Test that OpLoopMerge is emitted for non-shader targets without requiring
 ; SPV_INTEL_unstructured_loop_controls.

diff  --git a/llvm/test/CodeGen/SPIRV/pointers/global-vars-untyped.ll b/llvm/test/CodeGen/SPIRV/pointers/global-vars-untyped.ll
index c6652e488cac75..319d24707a7d54 100644
--- a/llvm/test/CodeGen/SPIRV/pointers/global-vars-untyped.ll
+++ b/llvm/test/CodeGen/SPIRV/pointers/global-vars-untyped.ll
@@ -1,4 +1,5 @@
 ; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -stop-after=ir-translator -o - | FileCheck %s
+; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -stop-after=ir-translator -enable-new-pm -o - | FileCheck %s
 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
 
 ; CHECK: @__spirv_BuiltInLocalInvocationId = external addrspace(1) global ptr addrspace

diff  --git a/llvm/test/CodeGen/SPIRV/structurizer/cf.while.continue.ll b/llvm/test/CodeGen/SPIRV/structurizer/cf.while.continue.ll
index e5545c62db5839..70edd56170efa9 100644
--- a/llvm/test/CodeGen/SPIRV/structurizer/cf.while.continue.ll
+++ b/llvm/test/CodeGen/SPIRV/structurizer/cf.while.continue.ll
@@ -1,5 +1,7 @@
 ; RUN: llc -mtriple=spirv-unknown-vulkan-compute -O0 %s -o - | FileCheck %s
 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan-compute %s -o - -filetype=obj | spirv-val %}
+; RUN: llc -mtriple=spirv-unknown-vulkan-compute -O0 -enable-new-pm %s -o - | FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan-compute -enable-new-pm %s -o - -filetype=obj | spirv-val %}
 
 ;
 ; int foo() { return true; }

diff  --git a/llvm/test/CodeGen/SPIRV/structurizer/do-continue.ll b/llvm/test/CodeGen/SPIRV/structurizer/do-continue.ll
index b95642f51c9fee..4f0e89dec65b24 100644
--- a/llvm/test/CodeGen/SPIRV/structurizer/do-continue.ll
+++ b/llvm/test/CodeGen/SPIRV/structurizer/do-continue.ll
@@ -1,5 +1,7 @@
 ; RUN: llc -mtriple=spirv-unknown-vulkan-compute -O0 %s -o - | FileCheck %s --match-full-lines
 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan-compute %s -o - -filetype=obj | spirv-val %}
+; RUN: llc -mtriple=spirv-unknown-vulkan-compute -O0 -enable-new-pm %s -o - | FileCheck %s --match-full-lines
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan-compute -enable-new-pm %s -o - -filetype=obj | spirv-val %}
 
 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"
 target triple = "spirv-unknown-vulkan1.3-compute"

diff  --git a/llvm/test/CodeGen/SPIRV/transcoding/NoSignedUnsignedWrap.ll b/llvm/test/CodeGen/SPIRV/transcoding/NoSignedUnsignedWrap.ll
index e66c4de5b65ac9..71b4b87bec95ef 100644
--- a/llvm/test/CodeGen/SPIRV/transcoding/NoSignedUnsignedWrap.ll
+++ b/llvm/test/CodeGen/SPIRV/transcoding/NoSignedUnsignedWrap.ll
@@ -8,6 +8,7 @@
 ;; Positive tests:
 ;;
 ; RUN: llc -O0 -mtriple=spirv32v1.3-unknown-unknown --spirv-ext=+SPV_KHR_no_integer_wrap_decoration %s -o - | FileCheck %s --check-prefixes=CHECK-SPIRV
+; RUN: llc -enable-new-pm -O0 -mtriple=spirv32v1.3-unknown-unknown --spirv-ext=+SPV_KHR_no_integer_wrap_decoration %s -o - | FileCheck %s --check-prefixes=CHECK-SPIRV
 ; RUN: llc -O0 -mtriple=spirv32v1.4-unknown-unknown %s -o - | FileCheck %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-NOEXT
 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32v1.4-unknown-unknown %s -o - -filetype=obj | spirv-val --target-env spv1.4 %}
 ;;

diff  --git a/llvm/unittests/Target/SPIRV/SPIRVAPITest.cpp b/llvm/unittests/Target/SPIRV/SPIRVAPITest.cpp
index 321c092bc7518f..ddaadfc3374079 100644
--- a/llvm/unittests/Target/SPIRV/SPIRVAPITest.cpp
+++ b/llvm/unittests/Target/SPIRV/SPIRVAPITest.cpp
@@ -15,6 +15,7 @@
 #include "llvm/AsmParser/Parser.h"
 #include "llvm/BinaryFormat/Magic.h"
 #include "llvm/IR/Module.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/TargetParser/Triple.h"
 #include "gtest/gtest.h"
@@ -109,6 +110,23 @@ TEST_F(SPIRVAPITest, checkTranslateOk) {
   }
 }
 
+TEST_F(SPIRVAPITest, checkTranslateNewPM) {
+  LLVMContext Context;
+  const char *Args[] = {"prog", "-force-new-pm-codegen"};
+  ASSERT_TRUE(cl::parseCommandLineOptions(Context.getLibraryOptions(), Args, "",
+                                          &nulls()));
+  SMDiagnostic ParseError;
+  std::unique_ptr<Module> M =
+      parseAssemblyString(OkAssembly, ParseError, Context);
+  ASSERT_TRUE(M);
+  std::string Result, Error;
+  bool Status =
+      SPIRVTranslate(M.get(), Result, Error, {}, CodeGenOptLevel::Default,
+                     Triple("spirv32-unknown-unknown"));
+  EXPECT_TRUE(Status && Error.empty() && !Result.empty());
+  EXPECT_EQ(identify_magic(Result), file_magic::spirv_object);
+}
+
 TEST_F(SPIRVAPITest, checkTranslateSupportExtensionByArg) {
   std::string Result, Error;
   std::vector<std::string> ExtNames{"SPV_KHR_uniform_group_instructions"};


        


More information about the llvm-branch-commits mailing list