[Mlir-commits] [mlir] 083617a - [mlir][unittest] Fix crash when building with MSVC 2022

Alexandre Ganea llvmlistbot at llvm.org
Wed Oct 5 09:17:26 PDT 2022


Author: Alexandre Ganea
Date: 2022-10-05T12:16:54-04:00
New Revision: 083617afc297f9d62a926fe8decbd9f616bd1b60

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

LOG: [mlir][unittest] Fix crash when building with MSVC 2022

The test Dialect/Affine/ops.mlir was failing when building with
Visual Studio 2022 version 17.3.5. This was caused by a bad MSVC codegen, when
capturing a `constexpr` in a lambda. The bug was reported to Microsoft, see
differential for more information.

Differential revision: https://reviews.llvm.org/D134227

Added: 
    

Modified: 
    mlir/lib/Dialect/Affine/IR/AffineOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index a71ba6d2f42d3..f200135847b8e 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -3807,7 +3807,9 @@ enum class MinMaxKind { Min, Max };
 static ParseResult parseAffineMapWithMinMax(OpAsmParser &parser,
                                             OperationState &result,
                                             MinMaxKind kind) {
-  constexpr llvm::StringLiteral tmpAttrStrName = "__pseudo_bound_map";
+  // Using `const` not `constexpr` below to workaround a MSVC optimizer bug,
+  // see: https://reviews.llvm.org/D134227#3821753
+  const llvm::StringLiteral tmpAttrStrName = "__pseudo_bound_map";
 
   StringRef mapName = kind == MinMaxKind::Min
                           ? AffineParallelOp::getUpperBoundsMapAttrStrName()


        


More information about the Mlir-commits mailing list