xref: /minix3/external/bsd/llvm/dist/clang/test/Frontend/profile-sample-use-loc-tracking.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // This file tests that -fprofile-sample-use enables location tracking
2*0a6a1f1dSLionel Sambuc // generation in the same way that -Rpass does. The sample profiler needs
3*0a6a1f1dSLionel Sambuc // to associate line locations in the profile to the code, so it needs the
4*0a6a1f1dSLionel Sambuc // frontend to emit source location annotations.
5*0a6a1f1dSLionel Sambuc 
6*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -fprofile-sample-use=%S/Inputs/profile-sample-use-loc-tracking.prof -emit-llvm -o - 2>/dev/null | FileCheck %s
7*0a6a1f1dSLionel Sambuc 
8*0a6a1f1dSLionel Sambuc // -fprofile-sample-use should produce source location annotations, exclusively
9*0a6a1f1dSLionel Sambuc // (just like -gmlt).
10*0a6a1f1dSLionel Sambuc // CHECK: , !dbg !
11*0a6a1f1dSLionel Sambuc // CHECK-NOT: DW_TAG_base_type
12*0a6a1f1dSLionel Sambuc 
13*0a6a1f1dSLionel Sambuc // But llvm.dbg.cu should be missing (to prevent writing debug info to
14*0a6a1f1dSLionel Sambuc // the final output).
15*0a6a1f1dSLionel Sambuc // CHECK-NOT: !llvm.dbg.cu = !{
16*0a6a1f1dSLionel Sambuc 
bar(int j)17*0a6a1f1dSLionel Sambuc int bar(int j) {
18*0a6a1f1dSLionel Sambuc   return (j + j - 2) * (j - 2) * j;
19*0a6a1f1dSLionel Sambuc }
20