From c20a9bb001855da5d14721ce2894e3be77a999fe Mon Sep 17 00:00:00 2001 From: Dmitry Dolgov <9erthalion6@gmail.com> Date: Thu, 1 Jun 2023 08:56:00 -0700 Subject: [PATCH] Allow configuring InlinerThreshold in C bindings for the new pass manager C bindings for the new pass manager seem to allow to set any option from LLVMPassBuilderOptions, except InlinerThreshold. Allow to configure it as well. Reviewed By: aeubanks Differential Revision: https://reviews.llvm.org/D151832 --- llvm/include/llvm-c/Transforms/PassBuilder.h | 3 +++ llvm/lib/Passes/PassBuilderBindings.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/llvm/include/llvm-c/Transforms/PassBuilder.h b/llvm/include/llvm-c/Transforms/PassBuilder.h index 6d9f1b4..d0466dd7 100644 --- a/llvm/include/llvm-c/Transforms/PassBuilder.h +++ b/llvm/include/llvm-c/Transforms/PassBuilder.h @@ -99,6 +99,9 @@ void LLVMPassBuilderOptionsSetCallGraphProfile( void LLVMPassBuilderOptionsSetMergeFunctions(LLVMPassBuilderOptionsRef Options, LLVMBool MergeFunctions); +void LLVMPassBuilderOptionsSetInlinerThreshold( + LLVMPassBuilderOptionsRef Options, int Threshold); + /** * Dispose of a heap-allocated PassBuilderOptions instance */ diff --git a/llvm/lib/Passes/PassBuilderBindings.cpp b/llvm/lib/Passes/PassBuilderBindings.cpp index 2a49ae6..0d3a3d7 100644 --- a/llvm/lib/Passes/PassBuilderBindings.cpp +++ b/llvm/lib/Passes/PassBuilderBindings.cpp @@ -139,6 +139,11 @@ void LLVMPassBuilderOptionsSetMergeFunctions(LLVMPassBuilderOptionsRef Options, unwrap(Options)->PTO.MergeFunctions = MergeFunctions; } +void LLVMPassBuilderOptionsSetInlinerThreshold( + LLVMPassBuilderOptionsRef Options, int Threshold) { + unwrap(Options)->PTO.InlinerThreshold = Threshold; +} + void LLVMDisposePassBuilderOptions(LLVMPassBuilderOptionsRef Options) { delete unwrap(Options); } -- 2.7.4