From b7050c791d8951c0a099bf162f9ab3a696611b7d Mon Sep 17 00:00:00 2001 From: Diana Picus Date: Wed, 22 Sep 2021 09:07:33 +0200 Subject: [PATCH] [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. 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 --- mlir/tools/mlir-tblgen/RewriterGen.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mlir/tools/mlir-tblgen/RewriterGen.cpp b/mlir/tools/mlir-tblgen/RewriterGen.cpp index 1c2ba75..823d551 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>(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>(attrs)); // In general, NativeCodeCall without naming binding don't need this. To // ensure void helper function has been correctly labeled, i.e., use -- 2.7.4