summaryrefslogtreecommitdiff
path: root/compiler/optimizing/load_store_analysis_test.cc
diff options
context:
space:
mode:
authorEvgeny Astigeevich <evgeny.astigeevich@linaro.org>2019-12-10 11:36:33 +0000
committerRoland Levillain <rpl@google.com>2020-01-08 14:43:19 +0000
commit7ee34a1eeba20c1b438f7bcad75adba65dd2a840 (patch)
treedc8988724cf4fc414e366c78ad62f5a05366eecb /compiler/optimizing/load_store_analysis_test.cc
parent7b0df59ff262975916ca9245b4c5092105d971bf (diff)
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
Diffstat (limited to 'compiler/optimizing/load_store_analysis_test.cc')
-rw-r--r--compiler/optimizing/load_store_analysis_test.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/optimizing/load_store_analysis_test.cc b/compiler/optimizing/load_store_analysis_test.cc
index bfe7a4f72f..d725aba9c8 100644
--- a/compiler/optimizing/load_store_analysis_test.cc
+++ b/compiler/optimizing/load_store_analysis_test.cc
@@ -106,6 +106,8 @@ TEST_F(LoadStoreAnalysisTest, ArrayHeapLocations) {
ASSERT_FALSE(heap_location_collector.MayAlias(loc1, loc2));
ASSERT_TRUE(heap_location_collector.MayAlias(loc1, loc3));
ASSERT_TRUE(heap_location_collector.MayAlias(loc1, loc3));
+
+ EXPECT_TRUE(CheckGraph(graph_));
}
TEST_F(LoadStoreAnalysisTest, FieldHeapLocations) {
@@ -183,6 +185,8 @@ TEST_F(LoadStoreAnalysisTest, FieldHeapLocations) {
ASSERT_TRUE(loc1 != loc2);
// accesses to different fields of the same object should not alias.
ASSERT_FALSE(heap_location_collector.MayAlias(loc1, loc2));
+
+ EXPECT_TRUE(CheckGraph(graph_));
}
TEST_F(LoadStoreAnalysisTest, ArrayIndexAliasingTest) {
@@ -273,6 +277,8 @@ TEST_F(LoadStoreAnalysisTest, ArrayIndexAliasingTest) {
loc1 = heap_location_collector.GetArrayHeapLocation(arr_set4);
loc2 = heap_location_collector.GetArrayHeapLocation(arr_set8);
ASSERT_TRUE(heap_location_collector.MayAlias(loc1, loc2));
+
+ EXPECT_TRUE(CheckGraphSkipRefTypeInfoChecks(graph_));
}
TEST_F(LoadStoreAnalysisTest, ArrayAliasingTest) {