[Mlir-commits] [mlir] b7050c7 - [mlir] Fix build on Windows on Arm

Diana Picus llvmlistbot at llvm.org
Thu Sep 23 00:07:45 PDT 2021


Author: Diana Picus
Date: 2021-09-23T09:04:28+02:00
New Revision: b7050c791d8951c0a099bf162f9ab3a696611b7d

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

LOG: [mlir] Fix build on Windows on Arm

clang-cl errors out while handling the templated version of tgfmt. This
patch works around the issue by explicitly choosing the non-templated
version of tgfmt, which takes an ArrayRef<std::string>.

More details in this thread:
https://lists.llvm.org/pipermail/cfe-dev/2021-September/068936.html

Thanks @Mehdi Amini for suggesting the fix :)

Differential Revision: https://reviews.llvm.org/D110223

Added: 
    

Modified: 
    mlir/tools/mlir-tblgen/RewriterGen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/tools/mlir-tblgen/RewriterGen.cpp b/mlir/tools/mlir-tblgen/RewriterGen.cpp
index 1c2ba75de6d3b..823d551e0705a 100644
--- a/mlir/tools/mlir-tblgen/RewriterGen.cpp
+++ b/mlir/tools/mlir-tblgen/RewriterGen.cpp
@@ -448,8 +448,9 @@ void PatternEmitter::emitNativeCodeMatch(DagNode tree, StringRef opName,
     PrintFatalError(loc, "NativeCodeCall must have $_self as argument for "
                          "passing the defining Operation");
 
-  auto nativeCodeCall = std::string(tgfmt(
-      fmt, &fmtCtx.addSubst("_loc", locToUse).withSelf(opName.str()), capture));
+  auto nativeCodeCall = std::string(
+      tgfmt(fmt, &fmtCtx.addSubst("_loc", locToUse).withSelf(opName.str()),
+            static_cast<ArrayRef<std::string>>(capture)));
 
   emitMatchCheck(opName, formatv("!failed({0})", nativeCodeCall),
                  formatv("\"{0} return failure\"", nativeCodeCall));
@@ -1152,7 +1153,8 @@ std::string PatternEmitter::handleReplaceWithNativeCodeCall(DagNode tree,
                             << " replacement: " << attrs[i] << "\n");
   }
 
-  std::string symbol = tgfmt(fmt, &fmtCtx.addSubst("_loc", locToUse), attrs);
+  std::string symbol = tgfmt(fmt, &fmtCtx.addSubst("_loc", locToUse),
+                             static_cast<ArrayRef<std::string>>(attrs));
 
   // In general, NativeCodeCall without naming binding don't need this. To
   // ensure void helper function has been correctly labeled, i.e., use


        


More information about the Mlir-commits mailing list