[llvm] [VPlan] Add hidden `-vplan-print-after-all` option (PR #175839)
Andrei Elovikov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 27 09:36:12 PST 2026
================
@@ -33,27 +33,47 @@ class VPRecipeBuilder;
struct VFRange;
LLVM_ABI_FOR_TEST extern cl::opt<bool> VerifyEachVPlan;
+LLVM_ABI_FOR_TEST extern cl::opt<bool> PrintAfterEachVPlanPass;
LLVM_ABI_FOR_TEST extern cl::opt<bool> EnableWideActiveLaneMask;
struct VPlanTransforms {
- /// Helper to run a VPlan transform \p Transform on \p VPlan, forwarding extra
- /// arguments to the transform. Returns the boolean returned by the transform.
- template <typename... ArgsTy>
- static bool runPass(bool (*Transform)(VPlan &, ArgsTy...), VPlan &Plan,
- typename std::remove_reference<ArgsTy>::type &...Args) {
- bool Res = Transform(Plan, Args...);
- if (VerifyEachVPlan)
- verifyVPlanIsValid(Plan);
- return Res;
- }
/// Helper to run a VPlan transform \p Transform on \p VPlan, forwarding extra
/// arguments to the transform.
- template <typename... ArgsTy>
- static void runPass(void (*Fn)(VPlan &, ArgsTy...), VPlan &Plan,
- typename std::remove_reference<ArgsTy>::type &...Args) {
- Fn(Plan, Args...);
- if (VerifyEachVPlan)
- verifyVPlanIsValid(Plan);
+ template <auto Transform, bool DisableVerify = false, typename... ArgsTy>
+ static auto runPass(VPlan &Plan, ArgsTy &&...Args) {
+ using ResTy = decltype(Transform(Plan, std::forward<ArgsTy>(Args)...));
+ // Needs to be directly in `runPass` and not inside a lambda below:
+ constexpr StringRef PrettyFunc{LLVM_PRETTY_FUNCTION};
----------------
eas wrote:
No, it won't, because `LLVM_PRETTY_FUNCTION` refers to the `runPass` helper, and `simplifyRecipes` is a template parameter for it. In the worst case, `LLVM_PRETTY_FUNCTION` would be just `__func__` that would only contain `runPass` without any of its template params.
https://github.com/llvm/llvm-project/pull/175839
More information about the llvm-commits
mailing list