Commit 5f50b8a3 authored by Ambroise Vincent's avatar Ambroise Vincent Committed by Commit Bot

[turbofan] delete redundant sorting

Vectors are being sorted multiple times in EmitBinarySearchSwitch().

Change-Id: I8c1053b8a5371904475a3f8c909041835e441d9e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2077683Reviewed-by: 's avatarMartyn Capewell <martyn.capewell@arm.com>
Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
Commit-Queue: Martyn Capewell <martyn.capewell@arm.com>
Cr-Commit-Position: refs/heads/master@{#66567}
parent 455cb6c0
...@@ -2351,8 +2351,6 @@ void InstructionSelector::EmitBinarySearchSwitch( ...@@ -2351,8 +2351,6 @@ void InstructionSelector::EmitBinarySearchSwitch(
inputs[0] = value_operand; inputs[0] = value_operand;
inputs[1] = g.Label(sw.default_branch()); inputs[1] = g.Label(sw.default_branch());
std::vector<CaseInfo> cases = sw.CasesSortedByValue(); std::vector<CaseInfo> cases = sw.CasesSortedByValue();
std::stable_sort(cases.begin(), cases.end(),
[](CaseInfo a, CaseInfo b) { return a.value < b.value; });
for (size_t index = 0; index < cases.size(); ++index) { for (size_t index = 0; index < cases.size(); ++index) {
const CaseInfo& c = cases[index]; const CaseInfo& c = cases[index];
inputs[index * 2 + 2 + 0] = g.TempImmediate(c.value); inputs[index * 2 + 2 + 0] = g.TempImmediate(c.value);
......
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