Commit f4b97a40 authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[wasm-simd][scalar-lowering] Fix lowering of returns

If return's input counts did not change, there is no need to change the
node at all.

Bug: chromium:1127620
Change-Id: I16d14a273d44b9fcd0b5a8af74b7a5a2eda569ff
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2434998
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70183}
parent 07e0c555
......@@ -1360,8 +1360,7 @@ void SimdScalarLowering::LowerNode(Node* node) {
break;
}
case IrOpcode::kReturn: {
// V128 return types are lowered to i32x4, so if the inputs to kReturn are
// not Word32, we need to convert them.
int old_input_count = node->InputCount();
int return_arity = static_cast<int>(signature()->return_count());
for (int i = 0; i < return_arity; i++) {
if (signature()->GetReturn(i) != MachineRepresentation::kSimd128) {
......@@ -1374,24 +1373,17 @@ void SimdScalarLowering::LowerNode(Node* node) {
continue;
}
switch (ReplacementType(input)) {
case SimdType::kInt8x16:
case SimdType::kInt16x8:
case SimdType::kInt64x2:
case SimdType::kFloat64x2:
case SimdType::kFloat32x4: {
// V128 return types are lowered to i32x4.
Node** reps = GetReplacementsWithType(input, rep_type);
ReplaceNode(input, reps, NumLanes(rep_type));
break;
}
case SimdType::kInt32x4: {
// No action needed.
DefaultLowering(node);
// Nothing needs to be done here since inputs did not change.
if (old_input_count == node->InputCount()) {
break;
}
}
}
DefaultLowering(node);
int new_return_count = GetReturnCountAfterLoweringSimd128(signature());
if (static_cast<int>(signature()->return_count()) != new_return_count) {
NodeProperties::ChangeOp(node, common()->Return(new_return_count));
......
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