summaryrefslogtreecommitdiff
path: root/compiler/optimizing/graph_checker.cc
diff options
context:
space:
mode:
author Roland Levillain <rpl@google.com> 2016-03-31 10:39:52 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-03-31 10:39:53 +0000
commitb0170f0457f60b81dd232bb3fa505b22f10f324c (patch)
treeb7297d1969458814ae5184cc62dc0a8eac437929 /compiler/optimizing/graph_checker.cc
parent6656f30115c4a6a52ca01f46ca84df125179466a (diff)
parentf355c3ff08710ac2eba3aac2aacc5e65caa06b4c (diff)
Merge "Fix Boolean to integral types conversions."
Diffstat (limited to 'compiler/optimizing/graph_checker.cc')
-rw-r--r--compiler/optimizing/graph_checker.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/optimizing/graph_checker.cc b/compiler/optimizing/graph_checker.cc
index f2e77e28a6..c790d013b5 100644
--- a/compiler/optimizing/graph_checker.cc
+++ b/compiler/optimizing/graph_checker.cc
@@ -1005,4 +1005,19 @@ void GraphChecker::VisitBoundType(HBoundType* instruction) {
}
}
+void GraphChecker::VisitTypeConversion(HTypeConversion* instruction) {
+ VisitInstruction(instruction);
+ Primitive::Type result_type = instruction->GetResultType();
+ Primitive::Type input_type = instruction->GetInputType();
+ // Invariant: We should never generate a conversion to a Boolean value.
+ if (result_type == Primitive::kPrimBoolean) {
+ AddError(StringPrintf(
+ "%s %d converts to a %s (from a %s).",
+ instruction->DebugName(),
+ instruction->GetId(),
+ Primitive::PrettyDescriptor(result_type),
+ Primitive::PrettyDescriptor(input_type)));
+ }
+}
+
} // namespace art