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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Jan 14 01:18:57 PST 2024


Author: Benjamin Maxwell
Date: 2024-01-14T09:18:53Z
New Revision: b0aebbd41a19045baa80aef3d269514be24f9fde

URL: https://github.com/llvm/llvm-project/commit/b0aebbd41a19045baa80aef3d269514be24f9fde
DIFF: https://github.com/llvm/llvm-project/commit/b0aebbd41a19045baa80aef3d269514be24f9fde.diff

LOG: [mlir][ArmSME] Workaround for old versions of GCC (NFC) (#78046)

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

Added: 
    

Modified: 
    mlir/lib/Conversion/ArmSMEToLLVM/ArmSMEToLLVM.cpp

Removed: 
    


################################################################################
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