Commit 3c03e3fc authored by Darshan Sen's avatar Darshan Sen Committed by V8 LUCI CQ

[compiler] Prevent extra copies of pair

This fixes the following compiler warning:

```
src/compiler/backend/register-allocator-verifier.cc:365:19: warning: loop variable 'pair' of type 'const
      std::__1::pair<const v8::internal::compiler::InstructionOperand, v8::internal::compiler::Assessment *>' creates a
      copy from type 'const std::__1::pair<const v8::internal::compiler::InstructionOperand,
      v8::internal::compiler::Assessment *>' [-Wrange-loop-analysis]
  for (const auto pair : map()) {
                  ^
src/compiler/backend/register-allocator-verifier.cc:365:8: note: use reference type 'const
      std::__1::pair<const v8::internal::compiler::InstructionOperand, v8::internal::compiler::Assessment *> &' to
      prevent copying
  for (const auto pair : map()) {
       ^~~~~~~~~~~~~~~~~
                  &
```
Signed-off-by: 's avatarDarshan Sen <raisinten@gmail.com>
Change-Id: Ifbaa85345d8dcdf56a68d194bba98d76878c96f3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3538286Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79555}
parent ce8a10b9
...@@ -362,7 +362,7 @@ bool BlockAssessments::IsStaleReferenceStackSlot(InstructionOperand op) { ...@@ -362,7 +362,7 @@ bool BlockAssessments::IsStaleReferenceStackSlot(InstructionOperand op) {
void BlockAssessments::Print() const { void BlockAssessments::Print() const {
StdoutStream os; StdoutStream os;
for (const auto pair : map()) { for (const auto& pair : map()) {
const InstructionOperand op = pair.first; const InstructionOperand op = pair.first;
const Assessment* assessment = pair.second; const Assessment* assessment = pair.second;
// Use operator<< so we can write the assessment on the same // Use operator<< so we can write the assessment on the same
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment