Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: src/compiler/typer.cc

Issue 2320803002: [turbofan] Ensure monotonicity for induction variable typing. (Closed)
Patch Set: Actual fix Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-644633.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/typer.cc
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc
index 9bb0613c71dabe325c88bfe553b2fdf2b0de08b0..70efe19e3caa2887b5798f787fc74bc744459755 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -635,9 +635,14 @@ Type* Typer::Visitor::TypeInductionVariablePhi(Node* node) {
// do not apply and we cannot do anything).
if (!initial_type->Is(typer_->cache_.kInteger) ||
!increment_type->Is(typer_->cache_.kInteger)) {
- // Fallback to normal phi typing.
- Type* type = Operand(node, 0);
- for (int i = 1; i < arity; ++i) {
+ // Fallback to normal phi typing, but ensure monotonicity.
+ // (Unfortunately, without baking in the previous type, monotonicity might
+ // be violated because we might not yet have retyped the incrementing
+ // operation even though the increment's type might been already reflected
+ // in the induction variable phi.)
+ Type* type = NodeProperties::IsTyped(node) ? NodeProperties::GetType(node)
+ : Type::None();
+ for (int i = 0; i < arity; ++i) {
type = Type::Union(type, Operand(node, i), zone());
}
return type;
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-644633.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698