summaryrefslogtreecommitdiff
path: root/compiler/optimizing/induction_var_analysis_test.cc
diff options
context:
space:
mode:
authorAart Bik <ajcbik@google.com>2015-09-28 16:25:56 -0700
committerAart Bik <ajcbik@google.com>2015-09-30 09:58:53 -0700
commit9401f5397128ddc8dc36de923dd5e6bd4e4b5be4 (patch)
tree4ff8052307da80baa89dfa80a446f48752c0e95c /compiler/optimizing/induction_var_analysis_test.cc
parent931e26843bbb688eacfa67b40414c6b8f221a56a (diff)
Implemented trip-count safety information.
As shown in the induction analysis presentation, trip-counts need to deal with potential taken/not-taken situations (so that trip-count is either valid in the full loop or just in the loop-body proper) and potential finite/infinite situations (the latter can still be analyzed but may need to run-time test later to guard against the infinite conditions). This CL provides that information. Change-Id: I0445d8e836b80a3614af217ce3e39d766e77b986
Diffstat (limited to 'compiler/optimizing/induction_var_analysis_test.cc')
-rw-r--r--compiler/optimizing/induction_var_analysis_test.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/optimizing/induction_var_analysis_test.cc b/compiler/optimizing/induction_var_analysis_test.cc
index e519e77f60..20492e7152 100644
--- a/compiler/optimizing/induction_var_analysis_test.cc
+++ b/compiler/optimizing/induction_var_analysis_test.cc
@@ -234,7 +234,8 @@ TEST_F(InductionVarAnalysisTest, FindBasicInduction) {
EXPECT_STREQ("((1) * i + (1))", GetInductionInfo(increment_[0], 0).c_str());
// Trip-count.
- EXPECT_STREQ("(100)", GetInductionInfo(loop_header_[0]->GetLastInstruction(), 0).c_str());
+ EXPECT_STREQ("(TC-loop:(100))",
+ GetInductionInfo(loop_header_[0]->GetLastInstruction(), 0).c_str());
}
TEST_F(InductionVarAnalysisTest, FindDerivedInduction) {
@@ -543,8 +544,10 @@ TEST_F(InductionVarAnalysisTest, FindRange) {
InductionVarRange range(iva_);
InductionVarRange::Value v_min = range.GetMinInduction(store, store->InputAt(1));
InductionVarRange::Value v_max = range.GetMaxInduction(store, store->InputAt(1));
+ ASSERT_TRUE(v_min.is_known);
EXPECT_EQ(0, v_min.a_constant);
EXPECT_EQ(1, v_min.b_constant);
+ ASSERT_TRUE(v_max.is_known);
EXPECT_EQ(0, v_max.a_constant);
EXPECT_EQ(199, v_max.b_constant);
}
@@ -579,7 +582,8 @@ TEST_F(InductionVarAnalysisTest, FindDeepLoopInduction) {
}
EXPECT_STREQ("((1) * i + (1))", GetInductionInfo(increment_[d], d).c_str());
// Trip-count.
- EXPECT_STREQ("(100)", GetInductionInfo(loop_header_[d]->GetLastInstruction(), d).c_str());
+ EXPECT_STREQ("(TC-loop:(100))",
+ GetInductionInfo(loop_header_[d]->GetLastInstruction(), d).c_str());
}
}