diff options
author | Chenguang Wang <w3cing@gmail.com> | 2022-09-06 21:28:23 +0200 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2022-09-06 21:28:25 +0200 |
commit | ae60a4a0efff337425638d04005b33a73dc5792f (patch) | |
tree | 5ad9f8d6dbf5782b68902e8a62a5978f56d2dd58 /lldb/source/Commands/CommandObjectFrame.cpp | |
parent | 7f2b016b820487f2fb69b93e784fff5d8297dea0 (diff) | |
download | llvm-ae60a4a0efff337425638d04005b33a73dc5792f.zip llvm-ae60a4a0efff337425638d04005b33a73dc5792f.tar.gz llvm-ae60a4a0efff337425638d04005b33a73dc5792f.tar.bz2 |
[mlir] Fix DenseElementsAttr::mapValues(i1, splat).
Splat of bool is encoded as a byte with all-ones in it [1]. Without this
change, this piece of code:
auto xs = builder.getI32TensorAttr({42, 42, 42, 42});
auto xs2 = xs.mapValues(builder.getI1Type(), [](const llvm::APInt &x) {
return x.isZero() ? llvm::APInt::getZero(1) : llvm::APInt::getAllOnes(1);
});
xs2.dump();
Prints:
dense<[true, false, false, false]> : tensor<4xi1>
Because only the first bit is set. This applies to both
DenseIntElementsAttr::mapValues() and DenseFPElementsAttr::mapValues().
[1]: https://github.com/llvm/llvm-project/blob/e877b42e2c70813352c1963ea33e992f481d5cba/mlir/lib/IR/BuiltinAttributes.cpp#L984
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D132767
Diffstat (limited to 'lldb/source/Commands/CommandObjectFrame.cpp')
0 files changed, 0 insertions, 0 deletions