summaryrefslogtreecommitdiffstats
path: root/clang/test/Frontend
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2014-10-22 13:00:05 +0000
committerDiego Novillo <dnovillo@google.com>2014-10-22 13:00:05 +0000
commit795f53ba640129d9d50e908aeabff90e751dbbed (patch)
tree9ba619ad3aace7a5b119e2c153c3b0045ecc6658 /clang/test/Frontend
parent8027b80b412574603340e00d42c1a0d08338c1de (diff)
downloadbcm5719-llvm-795f53ba640129d9d50e908aeabff90e751dbbed.tar.gz
bcm5719-llvm-795f53ba640129d9d50e908aeabff90e751dbbed.zip
Support using sample profiles with partial debug info (driver)
Summary: When using a profile, we used to require the use -gmlt so that we could get access to the line locations. This is used to match line numbers in the input profile to the line numbers in the function's IR. But this is actually not necessary. The driver can provide source location tracking without the emission of debug information. In these cases, the annotation 'llvm.dbg.cu' is missing from the IR, but the actual line location annotations are still present. This patch tells the driver to only emit source location tracking when -fprofile-sample-use is present in the command line. Reviewers: echristo, dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5888 llvm-svn: 220383
Diffstat (limited to 'clang/test/Frontend')
-rw-r--r--clang/test/Frontend/Inputs/profile-sample-use-loc-tracking.prof2
-rw-r--r--clang/test/Frontend/profile-sample-use-loc-tracking.c19
2 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/Frontend/Inputs/profile-sample-use-loc-tracking.prof b/clang/test/Frontend/Inputs/profile-sample-use-loc-tracking.prof
new file mode 100644
index 00000000000..ba9a678a452
--- /dev/null
+++ b/clang/test/Frontend/Inputs/profile-sample-use-loc-tracking.prof
@@ -0,0 +1,2 @@
+bar:100:100
+1: 2000
diff --git a/clang/test/Frontend/profile-sample-use-loc-tracking.c b/clang/test/Frontend/profile-sample-use-loc-tracking.c
new file mode 100644
index 00000000000..31faad68d39
--- /dev/null
+++ b/clang/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