[Mlir-commits] [mlir] [mlir][ArmSME] Workaround for old versions of GCC (NFC) (PR #78046)

Benjamin Maxwell llvmlistbot at llvm.org
Sat Jan 13 07:56:29 PST 2024


https://github.com/MacDue created https://github.com/llvm/llvm-project/pull/78046

See: https://github.com/llvm/llvm-project/pull/76086#issuecomment-1890424955

>From 7d17f325de37a93aadfbcc68ca83aa4ab67a9c95 Mon Sep 17 00:00:00 2001
From: Benjamin Maxwell <benjamin.maxwell at arm.com>
Date: Sat, 13 Jan 2024 15:50:55 +0000
Subject: [PATCH] [mlir][ArmSME] Workaround for old versions of GCC (NFC)

See: https://github.com/llvm/llvm-project/pull/76086#issuecomment-1890424955
---
 .../Conversion/ArmSMEToLLVM/ArmSMEToLLVM.cpp  | 40 ++++++++++---------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/mlir/lib/Conversion/ArmSMEToLLVM/ArmSMEToLLVM.cpp b/mlir/lib/Conversion/ArmSMEToLLVM/ArmSMEToLLVM.cpp
index f78b06776606ee..478253788a69bf 100644
--- a/mlir/lib/Conversion/ArmSMEToLLVM/ArmSMEToLLVM.cpp
+++ b/mlir/lib/Conversion/ArmSMEToLLVM/ArmSMEToLLVM.cpp
@@ -364,29 +364,31 @@ struct ConvertArmSMEOpToLLVMPattern : ConvertOpToLLVMPattern<SourceOp> {
   }
 };
 
+template <typename Pattern>
+static void addArmSMEConversionPattern(RewritePatternSet &patterns,
+                                       LLVMTypeConverter const &typeConverter) {
+  // Register spills/fills for ops that implement the
+  // `ArmSMETileOpInterface` and have `requiresSpillsAndFills` set to
+  // `RequiresSpillsAndFills::Yes`.
+  if constexpr (Pattern::requiresSpillsAndFillsConversion() &&
+                std::is_base_of_v<arm_sme::ArmSMETileOpInterface::Trait<
+                                      typename Pattern::ArmSMEOp>,
+                                  typename Pattern::ArmSMEOp>) {
+    // Add spill/fill conversions with a very high benefit to ensure
+    // they are lowered first.
+    patterns.add<ConvertArmSMESpillsAndFillsToLLVM>(
+        Pattern::ArmSMEOp::getOperationName(), typeConverter,
+        /*benefit=*/1337);
+  }
+  patterns.add<Pattern>(typeConverter);
+}
+
 /// Helper to register `ConvertArmSMEOpToLLVMPattern` patterns.
-template <typename... Pattern>
+template <typename... Patterns>
 static void
 addArmSMEConversionPatterns(RewritePatternSet &patterns,
                             LLVMTypeConverter const &typeConverter) {
-  (
-      [&] {
-        // Register spills/fills for ops that implement the
-        // `ArmSMETileOpInterface` and have `requiresSpillsAndFills` set to
-        // `RequiresSpillsAndFills::Yes`.
-        if constexpr (Pattern::requiresSpillsAndFillsConversion() &&
-                      std::is_base_of_v<arm_sme::ArmSMETileOpInterface::Trait<
-                                            typename Pattern::ArmSMEOp>,
-                                        typename Pattern::ArmSMEOp>) {
-          // Add spill/fill conversions with a very high benefit to ensure
-          // they are lowered first.
-          patterns.add<ConvertArmSMESpillsAndFillsToLLVM>(
-              Pattern::ArmSMEOp::getOperationName(), typeConverter,
-              /*benefit=*/1337);
-        }
-        patterns.add<Pattern>(typeConverter);
-      }(),
-      ...);
+  (addArmSMEConversionPattern<Patterns>(patterns, typeConverter), ...);
 }
 
 struct GetTileConversion



More information about the Mlir-commits mailing list