Commit 46d6ffed authored by jarin's avatar jarin Committed by Commit bot

[Turbofan] Only weaken types for Phi nodes.

We also need to fix the weakening to weaken unions with ranges in them.

BUG=

Review URL: https://codereview.chromium.org/1011103003

Cr-Commit-Position: refs/heads/master@{#27257}
parent 1f6c284a
...@@ -365,9 +365,11 @@ class Typer::Visitor : public Reducer { ...@@ -365,9 +365,11 @@ class Typer::Visitor : public Reducer {
if (NodeProperties::IsTyped(node)) { if (NodeProperties::IsTyped(node)) {
// Widen the bounds of a previously typed node. // Widen the bounds of a previously typed node.
Bounds previous = NodeProperties::GetBounds(node); Bounds previous = NodeProperties::GetBounds(node);
if (node->opcode() == IrOpcode::kPhi) {
// Speed up termination in the presence of range types: // Speed up termination in the presence of range types:
current.upper = Weaken(current.upper, previous.upper); current.upper = Weaken(current.upper, previous.upper);
current.lower = Weaken(current.lower, previous.lower); current.lower = Weaken(current.lower, previous.lower);
}
// Types should not get less precise. // Types should not get less precise.
DCHECK(previous.lower->Is(current.lower)); DCHECK(previous.lower->Is(current.lower));
...@@ -1309,16 +1311,14 @@ Type* Typer::Visitor::Weaken(Type* current_type, Type* previous_type) { ...@@ -1309,16 +1311,14 @@ Type* Typer::Visitor::Weaken(Type* current_type, Type* previous_type) {
return current_type; return current_type;
} }
Type* previous_number = Type::RangeType* previous =
Type::Intersect(previous_type, typer_->integer, zone()); Type::Intersect(previous_type, typer_->integer, zone())->GetRange();
Type* current_number = Type::Intersect(current_type, typer_->integer, zone()); Type::RangeType* current =
if (!current_number->IsRange() || !previous_number->IsRange()) { Type::Intersect(current_type, typer_->integer, zone())->GetRange();
if (current == nullptr || previous == nullptr) {
return current_type; return current_type;
} }
Type::RangeType* previous = previous_number->AsRange();
Type::RangeType* current = current_number->AsRange();
double current_min = current->Min(); double current_min = current->Min();
double new_min = current_min; double new_min = current_min;
// Find the closest lower entry in the list of allowed // Find the closest lower entry in the list of allowed
......
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