summaryrefslogtreecommitdiff
path: root/compiler/optimizing/graph_checker.cc
diff options
context:
space:
mode:
author Roland Levillain <rpl@google.com> 2015-01-19 12:44:01 +0000
committer Roland Levillain <rpl@google.com> 2015-01-19 12:44:01 +0000
commitaecbd26b29c6122d1eacfd67e0bd5aa26b96eebb (patch)
tree22ea87d86ca7a095c0af2b6a34b62492fd25abf3 /compiler/optimizing/graph_checker.cc
parentd599b39357cb0d3ab8b719357c86ffe609bb3fcb (diff)
Ensure HCondition nodes on objects are either HEqual or HNotEqual
Change-Id: I47efae209b7ab931d7d314e5b37582a7e21085d5
Diffstat (limited to 'compiler/optimizing/graph_checker.cc')
-rw-r--r--compiler/optimizing/graph_checker.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/compiler/optimizing/graph_checker.cc b/compiler/optimizing/graph_checker.cc
index b20d5892eb..291b14cb52 100644
--- a/compiler/optimizing/graph_checker.cc
+++ b/compiler/optimizing/graph_checker.cc
@@ -395,8 +395,14 @@ void SSAChecker::VisitCondition(HCondition* op) {
}
HInstruction* lhs = op->InputAt(0);
HInstruction* rhs = op->InputAt(1);
- if (lhs->GetType() == Primitive::kPrimNot && rhs->IsIntConstant()) {
- if (rhs->AsIntConstant()->GetValue() != 0) {
+ if (lhs->GetType() == Primitive::kPrimNot) {
+ if (!op->IsEqual() && !op->IsNotEqual()) {
+ std::stringstream error;
+ error << "Condition " << op->DebugName() << " " << op->GetId()
+ << " uses an object as left-hand side input.";
+ errors_.push_back(error.str());
+ }
+ if (rhs->IsIntConstant() && rhs->AsIntConstant()->GetValue() != 0) {
std::stringstream error;
error << "Condition " << op->DebugName() << " " << op->GetId()
<< " compares an object with a non-0 integer: "
@@ -404,8 +410,14 @@ void SSAChecker::VisitCondition(HCondition* op) {
<< ".";
errors_.push_back(error.str());
}
- } else if (rhs->GetType() == Primitive::kPrimNot && lhs->IsIntConstant()) {
- if (lhs->AsIntConstant()->GetValue() != 0) {
+ } else if (rhs->GetType() == Primitive::kPrimNot) {
+ if (!op->IsEqual() && !op->IsNotEqual()) {
+ std::stringstream error;
+ error << "Condition " << op->DebugName() << " " << op->GetId()
+ << " uses an object as right-hand side input.";
+ errors_.push_back(error.str());
+ }
+ if (lhs->IsIntConstant() && lhs->AsIntConstant()->GetValue() != 0) {
std::stringstream error;
error << "Condition " << op->DebugName() << " " << op->GetId()
<< " compares a non-0 integer with an object: "