Add OptimizingUnitTestHelper::GraphChecker methods
GraphChecker should be always used in gtests where it is possible.
Currently only ImprovedOptimizingUnitTest allows unit tests to use
GraphChecker. Unit tests based on OptimizingUnitTest cannot use this
functionality.
Another issue is that GraphChecker has reference type information
checks which unit tests cannot satisfy.
The CL resolves the issues by:
* Adding a public GraphChecker::SetRefTypeInfoCheckEnabled.
* Adding a private OptimizingUnitTestHelper::CheckGraph(HGraph* graph,
bool check_ref_type_info).
* Adding a public OptimizingUnitTestHelper::CheckGraph(graph) to perform
all checks.
* Adding a public
OptimizingUnitTestHelper::CheckGraphSkipRefTypeInfoChecks(graph) to
perform all checks but reference type information checks.
* Updating ImprovedOptimizingUnitTest::CheckGraph to use
OptimizingUnitTestHelper::CheckGraph.
To demonstrate how the new API can be used, unit tests for the
Load-Store-Analysis pass are updated.
Test: test.py --host --optimizing --jit --gtest
Test: test.py --target --optimizing --jit
Test: run-gtests.sh
Change-Id: I7ca0983e66d9904073f0d711b3de96cccfe42746
diff --git a/compiler/optimizing/graph_checker.cc b/compiler/optimizing/graph_checker.cc
index 01d9603..95cfe3e 100644
--- a/compiler/optimizing/graph_checker.cc
+++ b/compiler/optimizing/graph_checker.cc
@@ -497,7 +497,7 @@
}
// Ensure that reference type instructions have reference type info.
- if (instruction->GetType() == DataType::Type::kReference) {
+ if (check_reference_type_info_ && instruction->GetType() == DataType::Type::kReference) {
if (!instruction->GetReferenceTypeInfo().IsValid()) {
AddError(StringPrintf("Reference type instruction %s:%d does not have "
"valid reference type information.",