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

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

Issue 2709423002: [compiler] Speculate a little more in SpeculativeShiftRightLogical. (Closed)
Patch Set: Address feedback. Created 3 years, 10 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/shift-shr.js » ('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 74d157028d9cf147a3eb3e3c4091848c412e23e9..4acc77f22f3668fcee5dc4e7d911a2b853709bba 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -1986,8 +1986,26 @@ class RepresentationSelector {
if (BothInputsAre(node, Type::PlainPrimitive())) {
if (truncation.IsUnused()) return VisitUnused(node);
}
+ NumberOperationHint hint = NumberOperationHintOf(node->op());
+ Type* rhs_type = GetUpperBound(node->InputAt(1));
+ if (rhs_type->Is(type_cache_.kZeroish) &&
+ (hint == NumberOperationHint::kSignedSmall ||
+ hint == NumberOperationHint::kSigned32) &&
+ !truncation.IsUsedAsWord32()) {
+ // The SignedSmall or Signed32 feedback means that the results that we
+ // have seen so far were of type Unsigned31. We speculate that this
+ // will continue to hold. Moreover, since the RHS is 0, the result
+ // will just be the (converted) LHS.
+ VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint),
+ MachineRepresentation::kWord32, Type::Unsigned31());
+ if (lower()) {
+ node->RemoveInput(1);
+ NodeProperties::ChangeOp(node,
+ simplified()->CheckedUint32ToInt32());
+ }
+ return;
+ }
if (BothInputsAre(node, Type::NumberOrOddball())) {
- Type* rhs_type = GetUpperBound(node->InputAt(1));
VisitBinop(node, UseInfo::TruncatingWord32(),
UseInfo::TruncatingWord32(),
MachineRepresentation::kWord32);
@@ -1996,8 +2014,6 @@ class RepresentationSelector {
}
return;
}
- NumberOperationHint hint = NumberOperationHintOf(node->op());
- Type* rhs_type = GetUpperBound(node->InputAt(1));
VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint),
MachineRepresentation::kWord32, Type::Unsigned32());
if (lower()) {
« no previous file with comments | « no previous file | test/mjsunit/compiler/shift-shr.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698