summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
author Roland Levillain <rpl@google.com> 2016-02-24 15:46:01 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-02-24 15:46:01 +0000
commitd9ad7463eda39d9b8bee204f91a3b7b7fa6b0a1a (patch)
treee809c53bf8db2b902ee05c4d10ff689394268f5b /compiler/optimizing/nodes.cc
parent8b2c636a28148c09a64b8fbbd9afe7ea11cfe59b (diff)
parente53bd8160ad2892f33849108d3b1099992a311fd (diff)
Merge "Remove unreachable code paths in constant folding."
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r--compiler/optimizing/nodes.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index f36dc6e2fd..f9acb089ee 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -1178,19 +1178,19 @@ HConstant* HUnaryOperation::TryStaticEvaluation() const {
}
HConstant* HBinaryOperation::TryStaticEvaluation() const {
- if (GetLeft()->IsIntConstant()) {
- if (GetRight()->IsIntConstant()) {
- return Evaluate(GetLeft()->AsIntConstant(), GetRight()->AsIntConstant());
- } else if (GetRight()->IsLongConstant()) {
- return Evaluate(GetLeft()->AsIntConstant(), GetRight()->AsLongConstant());
- }
+ if (GetLeft()->IsIntConstant() && GetRight()->IsIntConstant()) {
+ return Evaluate(GetLeft()->AsIntConstant(), GetRight()->AsIntConstant());
} else if (GetLeft()->IsLongConstant()) {
if (GetRight()->IsIntConstant()) {
+ // The binop(long, int) case is only valid for shifts and rotations.
+ DCHECK(IsShl() || IsShr() || IsUShr() || IsRor()) << DebugName();
return Evaluate(GetLeft()->AsLongConstant(), GetRight()->AsIntConstant());
} else if (GetRight()->IsLongConstant()) {
return Evaluate(GetLeft()->AsLongConstant(), GetRight()->AsLongConstant());
}
} else if (GetLeft()->IsNullConstant() && GetRight()->IsNullConstant()) {
+ // The binop(null, null) case is only valid for equal and not-equal conditions.
+ DCHECK(IsEqual() || IsNotEqual()) << DebugName();
return Evaluate(GetLeft()->AsNullConstant(), GetRight()->AsNullConstant());
} else if (kEnableFloatingPointStaticEvaluation) {
if (GetLeft()->IsFloatConstant() && GetRight()->IsFloatConstant()) {