[llvm] Fix build breakage caused by #176061 (PR #176283)

Alan Zhao via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 15 16:42:03 PST 2026


https://github.com/alanzhao1 created https://github.com/llvm/llvm-project/pull/176283

https://github.com/llvm/llvm-project/pull/176061 added an extern declaration to `EnableMachineCombinerPass`, which is `static`, causing missing symbol errors in the debug build. This PR fixes this by making that symbol non-static. Furthermore, this PR renames that symbol to `EnableMachineCombinerPassX86` as `EnableMachineCombinerPass` exists in other places.

>From 47082321362a10f1256cc7f2f6d11b478ea64a44 Mon Sep 17 00:00:00 2001
From: Alan Zhao <ayzhao at google.com>
Date: Thu, 15 Jan 2026 16:37:30 -0800
Subject: [PATCH] Fix build breakage caused by #176061

https://github.com/llvm/llvm-project/pull/176061 added an extern
declaration to `EnableMachineCombinerPass`, which is `static`, causing
missing symbol errors in the debug build. This PR fixes this by making
that symbol non-static. Furthermore, this PR renames that symbol to
`EnableMachineCombinerPassX86` as `EnableMachineCombinerPass` exists in
other places.
---
 llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp | 4 ++--
 llvm/lib/Target/X86/X86TargetMachine.cpp      | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp b/llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp
index 5691b2e663212..3de2984b00b54 100644
--- a/llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp
+++ b/llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp
@@ -27,7 +27,7 @@
 
 using namespace llvm;
 
-extern cl::opt<bool> EnableMachineCombinerPass;
+extern cl::opt<bool> EnableMachineCombinerPassX86;
 
 namespace {
 
@@ -117,7 +117,7 @@ Error X86CodeGenPassBuilder::addInstSelector(PassManagerWrapper &PMW) const {
 
 void X86CodeGenPassBuilder::addILPOpts(PassManagerWrapper &PMW) const {
   addMachineFunctionPass(EarlyIfConverterPass(), PMW);
-  if (EnableMachineCombinerPass) {
+  if (EnableMachineCombinerPassX86) {
     // TODO(boomanaiden154): Add the MachineCombinerPass here once it has been
     // ported to the new pass manager.
   }
diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp
index d5907d55998b5..e37fd5a88e88c 100644
--- a/llvm/lib/Target/X86/X86TargetMachine.cpp
+++ b/llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -53,7 +53,7 @@
 
 using namespace llvm;
 
-static cl::opt<bool> EnableMachineCombinerPass("x86-machine-combiner",
+cl::opt<bool> EnableMachineCombinerPassX86("x86-machine-combiner",
                                cl::desc("Enable the machine combiner pass"),
                                cl::init(true), cl::Hidden);
 
@@ -497,7 +497,7 @@ void X86PassConfig::addPreLegalizeMachineIR() {
 
 bool X86PassConfig::addILPOpts() {
   addPass(&EarlyIfConverterLegacyID);
-  if (EnableMachineCombinerPass)
+  if (EnableMachineCombinerPassX86)
     addPass(&MachineCombinerID);
   addPass(createX86CmovConversionLegacyPass());
   return true;



More information about the llvm-commits mailing list