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

Unified Diff: src/compiler/simplified-lowering.cc

Issue 2306443003: [turbofan] Fix typing rule for CheckBounds. (Closed)
Patch Set: Improve lowering a bit. 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 | src/compiler/typer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
index 799ab1b23249c314744315de3f836df6b64d0c0d..f0d90f653b9de1a96837eb50c6c67adfcea51812 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -2090,21 +2090,20 @@ class RepresentationSelector {
case IrOpcode::kCheckBounds: {
Type* index_type = TypeOf(node->InputAt(0));
+ Type* length_type = TypeOf(node->InputAt(1));
if (index_type->Is(Type::Unsigned32())) {
VisitBinop(node, UseInfo::TruncatingWord32(),
MachineRepresentation::kWord32);
+ if (lower() && index_type->Max() < length_type->Min()) {
+ // The bounds check is redundant if we already know that
+ // the index is within the bounds of [0.0, length[.
+ DeferReplacement(node, node->InputAt(0));
+ }
} else {
VisitBinop(node, UseInfo::CheckedSigned32AsWord32(),
UseInfo::TruncatingWord32(),
MachineRepresentation::kWord32);
}
- if (lower()) {
- // The bounds check is redundant if we already know that
- // the index is within the bounds of [0.0, length[.
- if (index_type->Is(NodeProperties::GetType(node))) {
- DeferReplacement(node, node->InputAt(0));
- }
- }
return;
}
case IrOpcode::kCheckIf: {
« no previous file with comments | « no previous file | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698