profile-sample-use-loc-tracking.c 815 B

1234567891011121314151617181920
  1. // This file tests that -fprofile-sample-use enables location tracking
  2. // generation in the same way that -Rpass does. The sample profiler needs
  3. // to associate line locations in the profile to the code, so it needs the
  4. // frontend to emit source location annotations.
  5. // RUN: %clang_cc1 %s -fprofile-sample-use=%S/Inputs/profile-sample-use-loc-tracking.prof -emit-llvm -o - 2>/dev/null | FileCheck %s
  6. // -fprofile-sample-use should produce source location annotations, exclusively
  7. // (just like -gmlt).
  8. // CHECK: , !dbg !
  9. // CHECK-NOT: DW_TAG_base_type
  10. // The CU should be marked NoDebug (to prevent writing debug info to
  11. // the final output).
  12. // CHECK: !llvm.dbg.cu = !{![[CU:.*]]}
  13. // CHECK: ![[CU]] = distinct !DICompileUnit({{.*}}emissionKind: NoDebug
  14. int bar(int j) {
  15. return (j + j - 2) * (j - 2) * j;
  16. }