[llvm] [Pass] Use `function_traits` to infer `IRUnitT` and `AnalysisT` in `RequireAnalysisPass` (PR #89538)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 21 04:21:50 PDT 2024
https://github.com/paperchalice updated https://github.com/llvm/llvm-project/pull/89538
>From 129392df7f90f6b1463cbbbbc1b793bf2849f4c6 Mon Sep 17 00:00:00 2001
From: PaperChalice <liujunchang97 at outlook.com>
Date: Sun, 21 Apr 2024 19:20:12 +0800
Subject: [PATCH] [Pass] Use function_traits to infer `IRUnitT` and `AnalysisT`
in `RequireAnalysisPass`
---
llvm/include/llvm/IR/PassManager.h | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/llvm/include/llvm/IR/PassManager.h b/llvm/include/llvm/IR/PassManager.h
index d701481202f8db..5346f1bd9151dc 100644
--- a/llvm/include/llvm/IR/PassManager.h
+++ b/llvm/include/llvm/IR/PassManager.h
@@ -934,9 +934,13 @@ createModuleToFunctionPassAdaptor(FunctionPassT &&Pass,
///
/// Specific patterns of run-method extra arguments and analysis manager extra
/// arguments will have to be defined as appropriate specializations.
-template <typename AnalysisT, typename IRUnitT,
- typename AnalysisManagerT = AnalysisManager<IRUnitT>,
- typename... ExtraArgTs>
+template <
+ typename AnalysisT,
+ typename IRUnitT = std::remove_reference_t<
+ typename function_traits<typename AnalysisT::run>::template arg_t<0>>,
+ typename AnalysisManagerT = std::remove_reference_t<
+ typename function_traits<typename AnalysisT::run>::template arg_t<1>>,
+ typename... ExtraArgTs>
struct RequireAnalysisPass
: PassInfoMixin<RequireAnalysisPass<AnalysisT, IRUnitT, AnalysisManagerT,
ExtraArgTs...>> {
More information about the llvm-commits
mailing list