From e31addf7c358aba28ce0910e93d009397a72a05f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 12 Mar 2018 21:15:16 +0100 Subject: [PATCH] librustc_trans: Gate the preinliner with another -Z flag. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Emilio Cobos Álvarez --- src/librustc/session/config.rs | 3 +++ src/librustc_trans/llvm_util.rs | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 7f92a087ebfc..9fd370c54be9 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1254,6 +1254,9 @@ fn parse_edition(slot: &mut Edition, v: Option<&str>) -> bool { location if it's empty."), pgo_use: String = (String::new(), parse_string, [TRACKED], "Use PGO profile data from the given profile file."), + disable_instrumentation_preinliner: bool = + (false, parse_bool, [TRACKED], "Disable the instrumentation pre-inliner, \ + useful for profiling / PGO."), relro_level: Option = (None, parse_relro_level, [TRACKED], "choose which RELRO level to use"), nll: bool = (false, parse_bool, [UNTRACKED], diff --git a/src/librustc_trans/llvm_util.rs b/src/librustc_trans/llvm_util.rs index 12364b32d116..1c8f09ce7b3f 100644 --- a/src/librustc_trans/llvm_util.rs +++ b/src/librustc_trans/llvm_util.rs @@ -61,7 +61,9 @@ unsafe fn configure_llvm(sess: &Session) { add("rustc"); // fake program name if sess.time_llvm_passes() { add("-time-passes"); } if sess.print_llvm_passes() { add("-debug-pass=Structure"); } - add("-disable-preinline"); + if sess.opts.debugging_opts.disable_instrumentation_preinliner { + add("-disable-preinline"); + } for arg in &sess.opts.cg.llvm_args { add(&(*arg));