Skip to content

Commit 404d0e9

Browse files
committed
[mlir] Adjust code flagged by ClangTidyPerformance (NFC).
We can allocate the size of the vector in advance.
1 parent df335b0 commit 404d0e9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mlir/lib/Bindings/Python/IRAttributes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,11 +1102,11 @@ class PyDenseElementsAttribute
11021102
unpackedBooleans = unpackedBooleans[py::slice(0, numBooleans, 1)];
11031103
unpackedBooleans = equalFunc(unpackedBooleans, 1);
11041104

1105-
std::vector<intptr_t> shape;
11061105
MlirType shapedType = mlirAttributeGetType(*this);
11071106
intptr_t rank = mlirShapedTypeGetRank(shapedType);
1107+
std::vector<intptr_t> shape(rank);
11081108
for (intptr_t i = 0; i < rank; ++i) {
1109-
shape.push_back(mlirShapedTypeGetDimSize(shapedType, i));
1109+
shape[i] = mlirShapedTypeGetDimSize(shapedType, i);
11101110
}
11111111
unpackedBooleans = reshapeFunc(unpackedBooleans, shape);
11121112

0 commit comments

Comments
 (0)