| 1 | // Test that function entry counts are set correctly. |
| 2 | |
| 3 | // RUN: llvm-profdata merge %S/Inputs/func-entry.proftext -o %t.profdata |
| 4 | // RUN: %clang_cc1 %s -o - -disable-llvm-passes -emit-llvm -fprofile-instrument-use-path=%t.profdata | FileCheck %s |
| 5 | |
| 6 | void foo(void); |
| 7 | |
| 8 | // CHECK: @foo() #{{[0-9]}} !prof [[FOO:![0-9]+]] |
| 9 | void foo() { return; } |
| 10 | |
| 11 | // CHECK: @main() #{{[0-9]}} !prof [[MAIN:![0-9]+]] |
| 12 | int main() { |
| 13 | int i; |
| 14 | for (i = 0; i < 10000; i++) foo(); |
| 15 | return 0; |
| 16 | } |
| 17 | |
| 18 | // CHECK: [[FOO]] = !{!"function_entry_count", i64 1000} |
| 19 | // CHECK: [[MAIN]] = !{!"function_entry_count", i64 1} |
| 20 | |