Skip to content

Commit

Permalink
[mlir] Adjust code flagged by ClangTidyPerformance (NFC).
Browse files Browse the repository at this point in the history
We can allocate the size of the vector in advance.
  • Loading branch information
akuegel committed Nov 25, 2024
1 parent df335b0 commit 404d0e9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mlir/lib/Bindings/Python/IRAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1102,11 +1102,11 @@ class PyDenseElementsAttribute
unpackedBooleans = unpackedBooleans[py::slice(0, numBooleans, 1)];
unpackedBooleans = equalFunc(unpackedBooleans, 1);

std::vector<intptr_t> shape;
MlirType shapedType = mlirAttributeGetType(*this);
intptr_t rank = mlirShapedTypeGetRank(shapedType);
std::vector<intptr_t> shape(rank);
for (intptr_t i = 0; i < rank; ++i) {
shape.push_back(mlirShapedTypeGetDimSize(shapedType, i));
shape[i] = mlirShapedTypeGetDimSize(shapedType, i);
}
unpackedBooleans = reshapeFunc(unpackedBooleans, shape);

Expand Down

0 comments on commit 404d0e9

Please sign in to comment.