[Mlir-commits] [mlir] 90e0c65 - [mlir][sparse] Correcting the use of emplace_back
wren romano
llvmlistbot at llvm.org
Tue Aug 24 18:32:23 PDT 2021
Author: wren romano
Date: 2021-08-24T18:32:13-07:00
New Revision: 90e0c657b7cb3e4dd87229e338061d3cc27f6977
URL: https://github.com/llvm/llvm-project/commit/90e0c657b7cb3e4dd87229e338061d3cc27f6977
DIFF: https://github.com/llvm/llvm-project/commit/90e0c657b7cb3e4dd87229e338061d3cc27f6977.diff
LOG: [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
Added:
Modified:
mlir/lib/ExecutionEngine/SparseUtils.cpp
Removed:
################################################################################
diff --git a/mlir/lib/ExecutionEngine/SparseUtils.cpp b/mlir/lib/ExecutionEngine/SparseUtils.cpp
index e8f4567f904b8..c8c8bae9ec9e1 100644
--- a/mlir/lib/ExecutionEngine/SparseUtils.cpp
+++ b/mlir/lib/ExecutionEngine/SparseUtils.cpp
@@ -81,7 +81,7 @@ struct SparseTensor {
assert(getRank() == ind.size());
for (uint64_t r = 0, rank = getRank(); r < rank; r++)
assert(ind[r] < sizes[r]); // within bounds
- elements.emplace_back(Element<V>(ind, val));
+ elements.emplace_back(ind, val);
}
/// Sorts elements lexicographically by index.
void sort() { std::sort(elements.begin(), elements.end(), lexOrder); }
More information about the Mlir-commits
mailing list