Commit 5f845730 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[ptr-compr] Add int comparison cases in DecompressionOptimizer

There is at least one case where a Load output flows into an
In32LessThanOrEqual node without any bitcasts or truncations in the
middle. We have to consider these cases in the reducer.

Bug: v8:7703
Change-Id: I1ed9c41e80c0603fd287d096c3050c5ae27c2b3e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1879945
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64811}
parent a8928546
...@@ -74,6 +74,10 @@ void DecompressionOptimizer::MarkNodeInputs(Node* node) { ...@@ -74,6 +74,10 @@ void DecompressionOptimizer::MarkNodeInputs(Node* node) {
State::kOnly32BitsObserved); // value State::kOnly32BitsObserved); // value
break; break;
// BINOPS. // BINOPS.
case IrOpcode::kInt32LessThan:
case IrOpcode::kInt32LessThanOrEqual:
case IrOpcode::kUint32LessThan:
case IrOpcode::kUint32LessThanOrEqual:
case IrOpcode::kWord32And: case IrOpcode::kWord32And:
case IrOpcode::kWord32Equal: case IrOpcode::kWord32Equal:
DCHECK_EQ(node->op()->ValueInputCount(), 2); DCHECK_EQ(node->op()->ValueInputCount(), 2);
......
...@@ -461,6 +461,34 @@ TEST_F(DecompressionOptimizerTest, PhiWithOneCompressedAndOneTagged) { ...@@ -461,6 +461,34 @@ TEST_F(DecompressionOptimizerTest, PhiWithOneCompressedAndOneTagged) {
} }
} }
// -----------------------------------------------------------------------------
// Int cases.
TEST_F(DecompressionOptimizerTest, Int32LessThanOrEqualFromSpeculative) {
// This case tests for what SpeculativeNumberLessThanOrEqual is lowered to.
// Skip test if decompression elimination is enabled.
if (FLAG_turbo_decompression_elimination) {
return;
}
// Define variables.
Node* const control = graph()->start();
Node* object = Parameter(Type::Any(), 0);
Node* effect = graph()->start();
Node* index = Parameter(Type::UnsignedSmall(), 1);
// Test only for AnyTagged, since TaggedPointer can't be a Smi.
// Create the graph.
Node* load = graph()->NewNode(machine()->Load(MachineType::AnyTagged()),
object, index, effect, control);
Node* constant = graph()->NewNode(common()->Int64Constant(5));
graph()->SetEnd(
graph()->NewNode(machine()->Int32LessThanOrEqual(), load, constant));
// Change the nodes, and test the change.
Reduce();
EXPECT_EQ(LoadMachRep(load), CompressedMachRep(MachineType::AnyTagged()));
}
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
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