Index: src/compiler/typer.cc |
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc |
index f3fdaadaa94e5e09b9521fcf040020a8bb21354a..15229b60d4cfa80bd4ade16a77c1f8b8bde2ab62 100644 |
--- a/src/compiler/typer.cc |
+++ b/src/compiler/typer.cc |
@@ -365,9 +365,11 @@ class Typer::Visitor : public Reducer { |
if (NodeProperties::IsTyped(node)) { |
// Widen the bounds of a previously typed node. |
Bounds previous = NodeProperties::GetBounds(node); |
- // Speed up termination in the presence of range types: |
- current.upper = Weaken(current.upper, previous.upper); |
- current.lower = Weaken(current.lower, previous.lower); |
+ if (node->opcode() == IrOpcode::kPhi) { |
+ // Speed up termination in the presence of range types: |
+ current.upper = Weaken(current.upper, previous.upper); |
+ current.lower = Weaken(current.lower, previous.lower); |
+ } |
// Types should not get less precise. |
DCHECK(previous.lower->Is(current.lower)); |
@@ -1309,16 +1311,14 @@ Type* Typer::Visitor::Weaken(Type* current_type, Type* previous_type) { |
return current_type; |
} |
- Type* previous_number = |
- Type::Intersect(previous_type, typer_->integer, zone()); |
- Type* current_number = Type::Intersect(current_type, typer_->integer, zone()); |
- if (!current_number->IsRange() || !previous_number->IsRange()) { |
+ Type::RangeType* previous = |
+ Type::Intersect(previous_type, typer_->integer, zone())->GetRange(); |
+ Type::RangeType* current = |
+ Type::Intersect(current_type, typer_->integer, zone())->GetRange(); |
+ if (current == nullptr || previous == nullptr) { |
return current_type; |
} |
- Type::RangeType* previous = previous_number->AsRange(); |
- Type::RangeType* current = current_number->AsRange(); |
- |
double current_min = current->Min(); |
double new_min = current_min; |
// Find the closest lower entry in the list of allowed |