[llvm] [PluginLoader] Drop legacy -load option from llc (PR #217860)
Stefan Gränitz via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 21 04:52:35 PDT 2026
https://github.com/weliveindetail updated https://github.com/llvm/llvm-project/pull/217860
>From 5edbda8ada14717acea47ffd711de07adb565b6f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>
Date: Mon, 29 Jun 2026 11:40:48 +0200
Subject: [PATCH 1/3] [CodeGen] Switch plugin loading to -load-pass-plugin
---
llvm/test/Other/codegen-plugin-loading.ll | 2 +-
llvm/unittests/CodeGen/CGPluginTest/Plugin/Plugin.cpp | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
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/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};
+}
>From 68050ffe08195d516575ba890c3e51e5492a1a35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>
Date: Mon, 29 Jun 2026 11:43:54 +0200
Subject: [PATCH 2/3] [PluginLoader] Drop legacy -load option from llc
---
llvm/tools/llc/llc.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index 2c2a543862a28..119316938715b 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"
>From d31e7b0600bd06719726e9416a74a9443ce1b5f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>
Date: Fri, 21 Aug 2026 13:49:03 +0200
Subject: [PATCH 3/3] Drop docs for -load from llc (reverts #182455)
This reverts commit e411619dd232a5464f5b0fae24a88678fc6e50a4.
---
llvm/docs/CommandGuide/llc.rst | 6 ------
1 file changed, 6 deletions(-)
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*,
More information about the llvm-commits
mailing list