[llvm] c6c5541 - [PluginLoader] Drop legacy -load option from llc (#217860)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 00:04:49 PDT 2026


Author: Stefan Gränitz
Date: 2026-08-25T09:04:44+02:00
New Revision: c6c55417e835c450508eb73c736f768b4db8ede6

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

LOG: [PluginLoader] Drop legacy -load option from llc (#217860)

Loading of legacy Codegen pass plugins is the last remaining use-case
for the `-load` option in llc. We can drop it, if we switch the
respective test to `-load-pass-plugin`. We use the option only to load
the plugin shared-lib.

Added: 
    

Modified: 
    llvm/docs/CommandGuide/llc.rst
    llvm/test/Other/codegen-plugin-loading.ll
    llvm/tools/llc/llc.cpp
    llvm/unittests/CodeGen/CGPluginTest/Plugin/Plugin.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/docs/CommandGuide/llc.rst b/llvm/docs/CommandGuide/llc.rst
index 61c2589158e47..fdd12f3fbdb89 100644
--- a/llvm/docs/CommandGuide/llc.rst
+++ b/llvm/docs/CommandGuide/llc.rst
@@ -151,12 +151,6 @@ End-user Options
  Record the amount of time needed for each pass and print a report to standard
  error.
 
-.. option:: --load=<dso_path>
-
- Dynamically load ``dso_path`` (a path to a dynamically shared object) that
- implements an LLVM target.  This will permit the target name to be used with
- the :option:`-march` option so that code can be generated for that target.
-
 .. option:: -meabi=[default|gnu|4|5]
 
  Specify which EABI version should conform to.  Valid EABI versions are *gnu*,

diff  --git a/llvm/test/Other/codegen-plugin-loading.ll b/llvm/test/Other/codegen-plugin-loading.ll
index 7a8b724462735..cfbd239470ccb 100644
--- a/llvm/test/Other/codegen-plugin-loading.ll
+++ b/llvm/test/Other/codegen-plugin-loading.ll
@@ -1,4 +1,4 @@
-; RUN: llc -load %llvmshlibdir/CGTestPlugin%pluginext %s -o - | FileCheck %s
+; RUN: llc -load-pass-plugin %llvmshlibdir/CGTestPlugin%pluginext %s -o - | FileCheck %s
 ; REQUIRES: native, system-linux, llvm-dylib
 
 ; CHECK: CodeGen Test Pass running on main

diff  --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index 0ce1f3a5b4719..750ab0b1550ae 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -49,7 +49,6 @@
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/PGOOptions.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/PluginLoader.h"
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Support/TimeProfiler.h"

diff  --git a/llvm/unittests/CodeGen/CGPluginTest/Plugin/Plugin.cpp b/llvm/unittests/CodeGen/CGPluginTest/Plugin/Plugin.cpp
index ca2f1b929f633..76889a727976a 100644
--- a/llvm/unittests/CodeGen/CGPluginTest/Plugin/Plugin.cpp
+++ b/llvm/unittests/CodeGen/CGPluginTest/Plugin/Plugin.cpp
@@ -10,6 +10,7 @@
 
 #include <llvm/CodeGen/Passes.h>
 #include <llvm/CodeGen/TargetPassConfig.h>
+#include <llvm/Plugins/PassPlugin.h>
 #include <llvm/Target/RegisterTargetPassConfigCallback.h>
 
 using namespace llvm;
@@ -24,3 +25,12 @@ namespace {
 __attribute__((constructor)) static void initCodeGenPlugin() {
   initializeCodeGenTestPass(*PassRegistry::getPassRegistry());
 }
+
+// We use -load-pass-plugin to specify and load the plugin shared-lib, but not
+// the actual pass-plugin interface. This isn't available in the codegen
+// pipeline, as it doesn't use the New PassManager.
+extern "C" LLVM_ATTRIBUTE_WEAK ::llvm::PassPluginLibraryInfo
+llvmGetPassPluginInfo() {
+  return {LLVM_PLUGIN_API_VERSION, "CGTestPlugin", LLVM_VERSION_STRING, nullptr,
+          nullptr};
+}


        


More information about the llvm-commits mailing list