[llvm] Use `std::move` to avoid copy (PR #113080)
Nashe Mncube via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 22 06:54:48 PDT 2024
================
@@ -1377,7 +1377,7 @@ bool MachineLICMImpl::IsProfitableToHoist(MachineInstr &MI,
}) &&
IsLoopInvariantInst(MI, CurLoop) &&
any_of(MRI->use_nodbg_instructions(DefReg),
- [&CurLoop, this, DefReg, Cost](MachineInstr &UseMI) {
+ [&CurLoop, this, DefReg, std::move(Cost)](MachineInstr &UseMI) {
----------------
nasherm wrote:
If you want to do this you need to make use of move captures https://stackoverflow.com/a/20669290
This is only really supported in C++14 and higher. It also seems like this type of change could probably be made throughout the whole codebase. Is there any real reason to just focus on this one line?
https://github.com/llvm/llvm-project/pull/113080
More information about the llvm-commits
mailing list