[mlir] Fix for MSVC bool splat issue encountered.
authorKevin Gleason <gleasonk@google.com>
Tue, 25 Jul 2023 03:39:40 +0000 (20:39 -0700)
committerJacques Pienaar <jpienaar@google.com>
Tue, 25 Jul 2023 03:45:43 +0000 (20:45 -0700)
commit998003eaf7b91b5620eeb0b77c81654b9f36efb7
tree7f5b2fd7b398479a6323bc972ddb8a6e219d2ab6
parentdd84f5f91c6b234a2f188b6acf8557cae81b8a53
[mlir] Fix for MSVC bool splat issue encountered.

When building MLIR using bazel on windows with MSVC2019, bool splats
were being created incorrectly:

```
dense<[true,true,true,true]> : tensor<4xi1>
-(parse with mlir-opt)-> dense<[true, false, false, false]> : tensor<4xi1>
```

Appears that a Windows bazel build produces a corrupt DenseIntOrFPElementsAttr.
Unable to repro using MSVC and cmake.

Issue first discovered here:
https://github.com/google/jax/issues/16394

Added test point for reproduction:

```
$ bazel test @llvm-project//mlir/unittests:ir_tests --test_arg=--gtest_filter=DenseSplatTest.BoolSplatSmall
```

Differential Revision: https://reviews.llvm.org/D155745
mlir/lib/IR/AttributeDetail.h
mlir/lib/IR/BuiltinAttributes.cpp
mlir/unittests/IR/AttributeTest.cpp