[llvm] Allow PTO to be modified in PassBuilder (PR #92821)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 14:16:36 PDT 2024


https://github.com/modiking created https://github.com/llvm/llvm-project/pull/92821

llvmlite (and likely other LLVM-as-a-library users) allows changing Pipeline Tuning Options (PTO) of an existing PassBuilder. This seems meaningful enough to support directly instead of having to recreate a new PassBuilder for any modifications to PTO and all the memory management that comes along with this.

Testing:

ninja check

>From aa48c2ca929b0800c88180f82daaeaa995e716b0 Mon Sep 17 00:00:00 2001
From: modimo <modimo at fb.com>
Date: Thu, 16 May 2024 09:04:10 -0700
Subject: [PATCH] Allow PTO to be modified in PassBuilder

---
 llvm/include/llvm/Passes/PassBuilder.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/llvm/include/llvm/Passes/PassBuilder.h b/llvm/include/llvm/Passes/PassBuilder.h
index 8de0f024a4b11..100281e72133f 100644
--- a/llvm/include/llvm/Passes/PassBuilder.h
+++ b/llvm/include/llvm/Passes/PassBuilder.h
@@ -679,6 +679,10 @@ class PassBuilder {
                                               StringRef OptionName,
                                               StringRef PassName);
 
+  void setPipelineTuningOptions(PipelineTuningOptions Options) {
+    PTO = Options;
+  }
+
 private:
   // O1 pass pipeline
   FunctionPassManager



More information about the llvm-commits mailing list