mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 16:16:07 +00:00
[mlir] Adjust code flagged by ClangTidyPerformance (NFC).
We can allocate the size of the vector in advance.
This commit is contained in:
parent
df335b09ea
commit
404d0e9966
@ -1102,11 +1102,11 @@ private:
|
||||
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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user