[llvm] [CGData][GlobalIsel][Legalizer][DAG][MC][AsmParser][X86][AMX] Use `std::move` to avoid copy (PR #118068)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 4 23:08:41 PST 2024


================
@@ -35,7 +35,7 @@ LegalityPredicates::typeInSet(unsigned TypeIdx,
                               std::initializer_list<LLT> TypesInit) {
   SmallVector<LLT, 4> Types = TypesInit;
   return [=](const LegalityQuery &Query) {
-    return llvm::is_contained(Types, Query.Types[TypeIdx]);
+    return llvm::is_contained(std::move(Types), Query.Types[TypeIdx]);
----------------
topperc wrote:

This seems really weird. is_contained is a template function that takes a universal reference. Why do we need a move here?

https://github.com/llvm/llvm-project/pull/118068


More information about the llvm-commits mailing list