[llvm-branch-commits] [mlir] [mlir] Use `getSingleElement`/`hasSingleElement` in various places (PR #131460)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Mar 16 03:28:39 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff d781ac1cf0d561b79f6ff834d786c6a999429901 62173153f73910cdb2023700badeb27d5633c724 --extensions cpp,h -- llvm/include/llvm/ADT/STLExtras.h llvm/unittests/ADT/STLExtrasTest.cpp mlir/include/mlir/Dialect/CommonFolders.h mlir/lib/Analysis/SliceAnalysis.cpp mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp mlir/lib/Conversion/GPUToSPIRV/WmmaOpsToSPIRV.cpp mlir/lib/Conversion/MeshToMPI/MeshToMPI.cpp mlir/lib/Dialect/Affine/IR/AffineOps.cpp mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp mlir/lib/Dialect/Linalg/Transforms/SubsetInsertionOpInterfaceImpl.cpp mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp mlir/lib/Dialect/Quant/Transforms/StripFuncQuantTypes.cpp mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp mlir/lib/Dialect/SCF/Utils/Utils.cpp mlir/lib/Dialect/Shape/Transforms/BufferizableOpInterfaceImpl.cpp mlir/lib/Dialect/SparseTensor/Transforms/SparseIterationToScf.cpp mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorIterator.cpp mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp mlir/lib/Tools/PDLL/CodeGen/MLIRGen.cpp mlir/test/lib/Analysis/TestCFGLoopInfo.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/unittests/ADT/STLExtrasTest.cpp b/llvm/unittests/ADT/STLExtrasTest.cpp
index df8c0a4e48..d476710957 100644
--- a/llvm/unittests/ADT/STLExtrasTest.cpp
+++ b/llvm/unittests/ADT/STLExtrasTest.cpp
@@ -1025,7 +1025,7 @@ TEST(STLExtrasTest, getSingleElement) {
std::vector<int> V2 = {8};
EXPECT_EQ(getSingleElement(V2), 8);
- SmallVector<int> V3 {9};
+ SmallVector<int> V3{9};
EXPECT_EQ(getSingleElement(V3), 9);
std::list<int> L1 = {10};
diff --git a/mlir/lib/Conversion/MeshToMPI/MeshToMPI.cpp b/mlir/lib/Conversion/MeshToMPI/MeshToMPI.cpp
index 3339199588..87c2938e4e 100644
--- a/mlir/lib/Conversion/MeshToMPI/MeshToMPI.cpp
+++ b/mlir/lib/Conversion/MeshToMPI/MeshToMPI.cpp
@@ -769,17 +769,18 @@ struct ConvertMeshToMPIPass
typeConverter.addConversion([](Type type) { return type; });
// convert mesh::ShardingType to a tuple of RankedTensorTypes
- typeConverter.addConversion([](ShardingType type,
- SmallVectorImpl<Type> &results)
- -> std::optional<LogicalResult> {
- auto i16 = IntegerType::get(type.getContext(), 16);
- auto i64 = IntegerType::get(type.getContext(), 64);
- std::array<int64_t, 2> shp = {ShapedType::kDynamic, ShapedType::kDynamic};
- results.emplace_back(RankedTensorType::get(shp, i16));
- results.emplace_back(RankedTensorType::get(shp, i64)); // actually ?x2
- results.emplace_back(RankedTensorType::get(shp, i64));
- return success();
- });
+ typeConverter.addConversion(
+ [](ShardingType type,
+ SmallVectorImpl<Type> &results) -> std::optional<LogicalResult> {
+ auto i16 = IntegerType::get(type.getContext(), 16);
+ auto i64 = IntegerType::get(type.getContext(), 64);
+ std::array<int64_t, 2> shp = {ShapedType::kDynamic,
+ ShapedType::kDynamic};
+ results.emplace_back(RankedTensorType::get(shp, i16));
+ results.emplace_back(RankedTensorType::get(shp, i64)); // actually ?x2
+ results.emplace_back(RankedTensorType::get(shp, i64));
+ return success();
+ });
// To 'extract' components, a UnrealizedConversionCastOp is expected
// to define the input
``````````
</details>
https://github.com/llvm/llvm-project/pull/131460
More information about the llvm-branch-commits
mailing list