summaryrefslogtreecommitdiffstats
path: root/test/Frontend/profile-sample-use-loc-tracking.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Frontend/profile-sample-use-loc-tracking.c')
-rw-r--r--test/Frontend/profile-sample-use-loc-tracking.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Frontend/profile-sample-use-loc-tracking.c b/test/Frontend/profile-sample-use-loc-tracking.c
new file mode 100644
index 0000000..31faad6
--- /dev/null
+++ b/test/Frontend/profile-sample-use-loc-tracking.c
@@ -0,0 +1,19 @@
+// This file tests that -fprofile-sample-use enables location tracking
+// generation in the same way that -Rpass does. The sample profiler needs
+// to associate line locations in the profile to the code, so it needs the
+// frontend to emit source location annotations.
+
+// RUN: %clang_cc1 %s -fprofile-sample-use=%S/Inputs/profile-sample-use-loc-tracking.prof -emit-llvm -o - 2>/dev/null | FileCheck %s
+
+// -fprofile-sample-use should produce source location annotations, exclusively
+// (just like -gmlt).
+// CHECK: , !dbg !
+// CHECK-NOT: DW_TAG_base_type
+
+// But llvm.dbg.cu should be missing (to prevent writing debug info to
+// the final output).
+// CHECK-NOT: !llvm.dbg.cu = !{
+
+int bar(int j) {
+ return (j + j - 2) * (j - 2) * j;
+}
OpenPOWER on IntegriCloud