about summary refs log tree commit diff
path: root/src/rustllvm/PassWrapper.cpp
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2018-02-19 01:57:12 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2018-03-25 03:30:04 +0200
commit324ca7acd59be59abe0562287d5493f78a60823a (patch)
tree6625e70d0c0eec2fb29e3aa47c2522f9d063e0c6 /src/rustllvm/PassWrapper.cpp
parent50a38725e1841aa2283f198dbc8ef2bd5bd1370b (diff)
downloadrust-324ca7acd59be59abe0562287d5493f78a60823a.tar.gz
rust-324ca7acd59be59abe0562287d5493f78a60823a.zip
rustc_llvm: rustc_trans: Thread the PGO config down to the pass manager builder.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
-rw-r--r--src/rustllvm/PassWrapper.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp
index 06d1301d700..bee8ae5853f 100644
--- a/src/rustllvm/PassWrapper.cpp
+++ b/src/rustllvm/PassWrapper.cpp
@@ -428,12 +428,22 @@ extern "C" void LLVMRustAddAnalysisPasses(LLVMTargetMachineRef TM,
 
 extern "C" void LLVMRustConfigurePassManagerBuilder(
     LLVMPassManagerBuilderRef PMBR, LLVMRustCodeGenOptLevel OptLevel,
-    bool MergeFunctions, bool SLPVectorize, bool LoopVectorize) {
+    bool MergeFunctions, bool SLPVectorize, bool LoopVectorize,
+    const char* PGOGenPath, const char* PGOUsePath) {
   // Ignore mergefunc for now as enabling it causes crashes.
   // unwrap(PMBR)->MergeFunctions = MergeFunctions;
   unwrap(PMBR)->SLPVectorize = SLPVectorize;
   unwrap(PMBR)->OptLevel = fromRust(OptLevel);
   unwrap(PMBR)->LoopVectorize = LoopVectorize;
+  if (PGOGenPath) {
+    assert(!PGOUsePath);
+    unwrap(PMBR)->EnablePGOInstrGen = true;
+    unwrap(PMBR)->PGOInstrGen = PGOGenPath;
+  }
+  if (PGOUsePath) {
+    assert(!PGOGenPath);
+    unwrap(PMBR)->PGOInstrUse = PGOUsePath;
+  }
 }
 
 // Unfortunately, the LLVM C API doesn't provide a way to set the `LibraryInfo`