about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-03-26 13:00:18 +0000
committerbors <bors@rust-lang.org>2018-03-26 13:00:18 +0000
commit13a86f4d8555702085b97de3a42234a82ddc045d (patch)
tree45147330529a766d4a069e6f22ad79d31236fb29 /src/test
parent5e4603f99066eaf2c1cf19ac3afbac9057b1e177 (diff)
parent1e1d907e6a407a474d46af343678e45c4eb327f9 (diff)
Auto merge of #48346 - emilio:pgo, r=alexcrichton
Add basic PGO support.

This PR adds two mutually exclusive options for profile usage and generation using LLVM's instruction profile generation (the same as clang uses), `-C pgo-use` and `-C pgo-gen`.

See each commit for details.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-make-fulldeps/pgo-gen-lto/Makefile8
-rw-r--r--src/test/run-make-fulldeps/pgo-gen-lto/test.rs11
-rw-r--r--src/test/run-make-fulldeps/pgo-gen/Makefile8
-rw-r--r--src/test/run-make-fulldeps/pgo-gen/test.rs11
4 files changed, 38 insertions, 0 deletions
diff --git a/src/test/run-make-fulldeps/pgo-gen-lto/Makefile b/src/test/run-make-fulldeps/pgo-gen-lto/Makefile
new file mode 100644
index 00000000000..e8c695f52be
--- /dev/null
+++ b/src/test/run-make-fulldeps/pgo-gen-lto/Makefile
@@ -0,0 +1,8 @@
+-include ../tools.mk
+
+all:
+ifeq ($(PROFILER_SUPPORT),1)
+	$(RUSTC) -Copt-level=3 -Clto=fat -Z pgo-gen="$(TMPDIR)/test.profraw" test.rs
+	$(call RUN,test) || exit 1
+	[ -e "$(TMPDIR)/test.profraw" ] || (echo "No .profraw file"; exit 1)
+endif
diff --git a/src/test/run-make-fulldeps/pgo-gen-lto/test.rs b/src/test/run-make-fulldeps/pgo-gen-lto/test.rs
new file mode 100644
index 00000000000..3f07b46791d
--- /dev/null
+++ b/src/test/run-make-fulldeps/pgo-gen-lto/test.rs
@@ -0,0 +1,11 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {}
diff --git a/src/test/run-make-fulldeps/pgo-gen/Makefile b/src/test/run-make-fulldeps/pgo-gen/Makefile
new file mode 100644
index 00000000000..7dc227b5a14
--- /dev/null
+++ b/src/test/run-make-fulldeps/pgo-gen/Makefile
@@ -0,0 +1,8 @@
+-include ../tools.mk
+
+all:
+ifeq ($(PROFILER_SUPPORT),1)
+	$(RUSTC) -g -Z pgo-gen="$(TMPDIR)/test.profraw" test.rs
+	$(call RUN,test) || exit 1
+	[ -e "$(TMPDIR)/test.profraw" ] || (echo "No .profraw file"; exit 1)
+endif
diff --git a/src/test/run-make-fulldeps/pgo-gen/test.rs b/src/test/run-make-fulldeps/pgo-gen/test.rs
new file mode 100644
index 00000000000..3f07b46791d
--- /dev/null
+++ b/src/test/run-make-fulldeps/pgo-gen/test.rs
@@ -0,0 +1,11 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {}