Skip to content

Commit 90e0c65

Browse files
committed
[mlir][sparse] Correcting the use of emplace_back
The emplace commands are variadic and should take all the constructor arguments directly, since they implicitly call the constructor themselves in order to avoid the cost of constructing and then moving/copying temporaries. Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D108670
1 parent d5244fb commit 90e0c65

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mlir/lib/ExecutionEngine/SparseUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ struct SparseTensor {
8181
assert(getRank() == ind.size());
8282
for (uint64_t r = 0, rank = getRank(); r < rank; r++)
8383
assert(ind[r] < sizes[r]); // within bounds
84-
elements.emplace_back(Element<V>(ind, val));
84+
elements.emplace_back(ind, val);
8585
}
8686
/// Sorts elements lexicographically by index.
8787
void sort() { std::sort(elements.begin(), elements.end(), lexOrder); }

0 commit comments

Comments
 (0)