// PGOGEN: @[[BSC:__llvm_pgo_ctr[0-9]*]] = private global [17 x i64] zeroinitializer
// PGOGEN: @[[BOC:__llvm_pgo_ctr[0-9]*]] = private global [8 x i64] zeroinitializer
// PGOGEN: @[[BLC:__llvm_pgo_ctr[0-9]*]] = private global [9 x i64] zeroinitializer
-// PGOGEN: @[[NOC:__llvm_pgo_ctr[0-9]*]] = private global [2 x i64] zeroinitializer
// PGOGEN: @[[MAC:__llvm_pgo_ctr[0-9]*]] = private global [1 x i64] zeroinitializer
// PGOGEN: @[[STC:__llvm_pgo_ctr[0-9]*]] = private global [2 x i64] zeroinitializer
}
}
-// PGOGEN-LABEL: @no_usable_data()
-// PGOUSE-LABEL: @no_usable_data()
-// PGOGEN: store {{.*}} @[[NOC]], i64 0, i64 0
-void no_usable_data() {
- // The input data for PGOUSE is deliberately invalid for this function, so
- // that we can test that we reject and ignore it properly.
- int i = 0;
-
- // PGOGEN: store {{.*}} @[[NOC]], i64 0, i64 1
- if (i) {}
-
- // PGOGEN-NOT: store {{.*}} @[[NOC]],
- // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
-}
-
// PGOGEN-LABEL: @static_func()
// PGOUSE-LABEL: @static_func()
// PGOGEN: store {{.*}} @[[STC]], i64 0, i64 0
boolean_operators();
boolop_loops();
do_fallthrough();
- no_usable_data();
static_func();
return 0;
}
--- /dev/null
+// Test that outdated data is ignored.
+
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-outdated-data.c %s -o - -emit-llvm -fprofile-instr-use=%S/Inputs/c-outdated-data.profdata | FileCheck -check-prefix=PGOUSE %s
+
+// TODO: We should have a warning or a remark that tells us the profile data was
+// discarded, rather than just checking that we fail to add metadata.
+
+// PGOUSE-LABEL: @no_usable_data()
+void no_usable_data() {
+ int i = 0;
+
+ if (i) {}
+
+#ifdef GENERATE_OUTDATED_DATA
+ if (i) {}
+#endif
+
+ // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
+}
+
+int main(int argc, const char *argv[]) {
+ no_usable_data();
+ return 0;
+}
// WRPUSE-NOT: br {{.*}} !prof ![0-9]+
// WRPUSE: ret
}
-// WRPUSE: ![[SW1]] = metadata !{metadata !"branch_weights", i32 100, i32 2}
+// WRPUSE: ![[SW1]] = metadata !{metadata !"branch_weights", i32 101, i32 2}
int main(int argc, const char *argv[]) {
simple_wrapper();