[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
This commit is contained in:
Alexandre Ganea 2022-09-30 08:27:04 -04:00
parent 941f71adf6
commit 083617afc2
1 changed files with 3 additions and 1 deletions

View File

@ -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()