r236361 - InstrProf: Add a couple of checks to this test
Justin Bogner
mail at justinbogner.com
Fri May 1 15:52:48 PDT 2015
Author: bogner
Date: Fri May 1 17:52:48 2015
New Revision: 236361
URL: http://llvm.org/viewvc/llvm-project?rev=236361&view=rev
Log:
InstrProf: Add a couple of checks to this test
"Don't crash" tests are silly, we might as well check that the
counters are consistent here.
Modified:
cfe/trunk/test/Profile/c-general.c
Modified: cfe/trunk/test/Profile/c-general.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Profile/c-general.c?rev=236361&r1=236360&r2=236361&view=diff
==============================================================================
--- cfe/trunk/test/Profile/c-general.c (original)
+++ cfe/trunk/test/Profile/c-general.c Fri May 1 17:52:48 2015
@@ -17,6 +17,7 @@
// PGOGEN: @[[BOC:__llvm_profile_counters_boolean_operators]] = private global [8 x i64] zeroinitializer
// PGOGEN: @[[BLC:__llvm_profile_counters_boolop_loops]] = private global [9 x i64] zeroinitializer
// PGOGEN: @[[COC:__llvm_profile_counters_conditional_operator]] = private global [3 x i64] zeroinitializer
+// PGOGEN: @[[DFC:__llvm_profile_counters_do_fallthrough]] = private global [4 x i64] zeroinitializer
// PGOGEN: @[[MAC:__llvm_profile_counters_main]] = private global [1 x i64] zeroinitializer
// PGOGEN: @[[STC:"__llvm_profile_counters_c-general.c:static_func"]] = private global [2 x i64] zeroinitializer
@@ -436,15 +437,24 @@ void conditional_operator() {
// PGOUSE-NOT: br {{.*}} !prof ![0-9]+
}
+// PGOGEN-LABEL: @do_fallthrough()
+// PGOUSE-LABEL: @do_fallthrough()
+// PGOGEN: store {{.*}} @[[DFC]], i64 0, i64 0
void do_fallthrough() {
+ // PGOGEN: store {{.*}} @[[DFC]], i64 0, i64 1
+ // PGOUSE: br {{.*}} !prof ![[DF1:[0-9]+]]
for (int i = 0; i < 10; ++i) {
int j = 0;
+ // PGOGEN: store {{.*}} @[[DFC]], i64 0, i64 2
do {
// The number of exits out of this do-loop via the break statement
// exceeds the counter value for the loop (which does not include the
// fallthrough count). Make sure that does not violate any assertions.
+ // PGOGEN: store {{.*}} @[[DFC]], i64 0, i64 3
+ // PGOUSE: br {{.*}} !prof ![[DF3:[0-9]+]]
if (i < 8) break;
j++;
+ // PGOUSE: br {{.*}} !prof ![[DF2:[0-9]+]]
} while (j < 2);
}
}
@@ -529,6 +539,11 @@ static void static_func() {
// PGOUSE-DAG: ![[BL8]] = !{!"branch_weights", i32 51, i32 2}
// PGOUSE-DAG: ![[CO1]] = !{!"branch_weights", i32 1, i32 2}
// PGOUSE-DAG: ![[CO2]] = !{!"branch_weights", i32 2, i32 1}
+
+// PGOUSE-DAG: ![[DF1]] = !{!"branch_weights", i32 11, i32 2}
+// PGOUSE-DAG: ![[DF2]] = !{!"branch_weights", i32 3, i32 3}
+// PGOUSE-DAG: ![[DF3]] = !{!"branch_weights", i32 9, i32 5}
+
// PGOUSE-DAG: ![[ST1]] = !{!"branch_weights", i32 11, i32 2}
int main(int argc, const char *argv[]) {
More information about the cfe-commits
mailing list