about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-04-25 03:05:22 +0200
committerGitHub <noreply@github.com>2019-04-25 03:05:22 +0200
commitbb892be98edeced022881397b1d64b968943aea7 (patch)
tree43224d29b29d4e93edbf5cdc6562a3f25077fe84 /src/test/codegen
parenta552bebaf60cfdce1a53241ce78462415ae3125c (diff)
parentff976fe0f13491f0e6d3f7cbd52ab409fd93165a (diff)
downloadrust-bb892be98edeced022881397b1d64b968943aea7.tar.gz
rust-bb892be98edeced022881397b1d64b968943aea7.zip
Rollup merge of #60038 - michaelwoerister:pgo-updates-2, r=alexcrichton
Add codegen test for PGO instrumentation.

This PR adds a codegen test that makes sure that LLVM actually generates instrumentation code when we enable PGO instrumentation in `rustc`.

The second commit updates a test case to the new commandline option syntax introduced in #59874. Without the fix the test still works, but it confusingly creates a directory called `test.profraw`, which usually is the name of the _file_ where profiling data is collected.
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/pgo-instrumentation.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/codegen/pgo-instrumentation.rs b/src/test/codegen/pgo-instrumentation.rs
new file mode 100644
index 00000000000..8493ef565d8
--- /dev/null
+++ b/src/test/codegen/pgo-instrumentation.rs
@@ -0,0 +1,20 @@
+// Test that `-Zpgo-gen` creates expected instrumentation artifacts in LLVM IR.
+
+// needs-profiler-support
+// compile-flags: -Z pgo-gen -Ccodegen-units=1
+
+// CHECK: @__llvm_profile_raw_version =
+// CHECK: @__profc_{{.*}}pgo_instrumentation{{.*}}some_function{{.*}} = private global
+// CHECK: @__profd_{{.*}}pgo_instrumentation{{.*}}some_function{{.*}} = private global
+// CHECK: @__profc_{{.*}}pgo_instrumentation{{.*}}main{{.*}} = private global
+// CHECK: @__profd_{{.*}}pgo_instrumentation{{.*}}main{{.*}} = private global
+// CHECK: @__llvm_profile_filename = {{.*}}"default_%m.profraw\00"{{.*}}
+
+#[inline(never)]
+fn some_function() {
+
+}
+
+fn main() {
+    some_function();
+}