https://github.com/NuriAmari created https://github.com/llvm/llvm-project/pull/183525
Without this change, passing -fthinlto-index causes -fpass-plugin arguments to be ignored. We want to be able to use plugins with distributed thin-lto, so add support for this. >From cfe82951e17fd541e9eb436161a827fc0032dc70 Mon Sep 17 00:00:00 2001 From: Nuri Amari <[email protected]> Date: Tue, 24 Feb 2026 14:34:51 -0800 Subject: [PATCH] Support -fpass-plugin + -fthinlto-index together Without this change, passing -fthinlto-index causes -fpass-plugin arguments to be ignored. We want to be able to use plugins with distributed thin-lto, so add support for this. --- clang/lib/CodeGen/BackendUtil.cpp | 1 + .../distributed-thin-lto/pass-plugin.ll | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 clang/test/CodeGen/distributed-thin-lto/pass-plugin.ll diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 94257fb96fc7f..9b7c7cef8a5d3 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -1382,6 +1382,7 @@ runThinLTOBackend(CompilerInstance &CI, ModuleSummaryIndex *CombinedIndex, Conf.RemarksFormat = CGOpts.OptRecordFormat; Conf.SplitDwarfFile = CGOpts.SplitDwarfFile; Conf.SplitDwarfOutput = CGOpts.SplitDwarfOutput; + Conf.PassPlugins = CGOpts.PassPlugins; switch (Action) { case Backend_EmitNothing: Conf.PreCodeGenModuleHook = [](size_t Task, const llvm::Module &Mod) { diff --git a/clang/test/CodeGen/distributed-thin-lto/pass-plugin.ll b/clang/test/CodeGen/distributed-thin-lto/pass-plugin.ll new file mode 100644 index 0000000000000..fef5f1f3c2c0c --- /dev/null +++ b/clang/test/CodeGen/distributed-thin-lto/pass-plugin.ll @@ -0,0 +1,25 @@ +; REQUIRES: x86-registered-target, plugins, examples + +;; Validate that -fpass-plugin works for distributed ThinLTO backends. + +; RUN: opt -thinlto-bc -o %t.o %s + +; RUN: llvm-lto2 run -thinlto-distributed-indexes %t.o \ +; RUN: -o %t2.index \ +; RUN: -r=%t.o,main,px + +; RUN: %clang_cc1 -triple x86_64-grtev4-linux-gnu \ +; RUN: -O2 -emit-obj -fthinlto-index=%t.o.thinlto.bc \ +; RUN: -fpass-plugin=%llvmshlibdir/Bye%pluginext \ +; RUN: -mllvm -wave-goodbye \ +; RUN: -o %t.native.o -x ir %t.o 2>&1 | FileCheck %s + +; CHECK: Bye: main + +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-grtev4-linux-gnu" + +define i32 @main() { +entry: + ret i32 0 +} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
