<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/74542>74542</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `performance-unnecessary-value-param` produces false positive and less efficient fix when passing via a tuple of rvalue references
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          sfc-gh-bhannel
      </td>
    </tr>
</table>

<pre>
    Here is a minimal reproduction of the issue I am describing: https://godbolt.org/z/8WGqM9Evr

The relevant snippet:
```
std::vector<TrackedType> storage;

template <class T>
void emplace(T&& arg) {
  std::tuple<T&&> tup(std::forward<T>(arg));
  std::cout << "Type of tuple: " << typeName(tup) << std::endl;
 storage.emplace_back(std::move(std::get<0>(tup)));
}

void byValue(TrackedType value) {
 emplace(std::move(value));
}
```

`clang-tidy` 17.0.1 suggests passing by const reference to `byValue`, which will cause a copy where previously there was none. `--fix` will apply this pessimization, potentially regressing performance sensitive code.

This happens in practice with the API of `absl::flat_hash_map`, which is very widely used. An example of that: https://godbolt.org/z/hdb3q54ej
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVMFu4zYQ_Rr6MrAhU7JsH3TwJnG7hxY9BO0xGJEjibsUySUpOdqvLyg5sZP2sIBgQ5zRvMc3bwZDUK0hqtjuC9s9rnCInfVVaMS67dZ1h8aQXtVWTtXv5AlUAIReGdWjBk_OWzmIqKwB20DsUkIYCL4C9iApCK9qZVqWn6CL0QWWnxg_M35uraytjhvrW8bPPxk_H_757ccfx6fRs-yRZafl97kj8KRpRBMhGOUcxVRjSSmz6zO_hihTKD-NJKL1LH949ii-k3yeHLH8CUK0Hlti-Zd7iEi90xgJWP4gNIYAzyx_WmKjVRLmuCDGD8-Ml4yXgIn0Edj-WgjgHTsOTlOCXlITbBwc44f3jMb6C3o55-RPjB-WaunJ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