diff options
author | Leonard Chan <leonardchan@google.com> | 2019-06-13 17:25:36 +0000 |
---|---|---|
committer | Leonard Chan <leonardchan@google.com> | 2019-06-13 17:25:36 +0000 |
commit | ab2c0ed01edfec9a9402d03bdf8633b34b73f3a7 (patch) | |
tree | 7e6fb36c1cbbe65e3acfeaebc5f4a56ad06728f3 /clang/lib/CodeGen/BackendUtil.cpp | |
parent | 587497b87d08bf85e08da2b41605d17f1852ede1 (diff) | |
download | bcm5719-llvm-ab2c0ed01edfec9a9402d03bdf8633b34b73f3a7.tar.gz bcm5719-llvm-ab2c0ed01edfec9a9402d03bdf8633b34b73f3a7.zip |
[clang][NewPM] Fix broken profile test
This contains the part of D62225 which fixes Profile/gcc-flag-compatibility.c
by adding the pass that allows default profile generation to work under the new
PM. It seems that ./default.profraw was not being generated with new PM enabled.
Differential Revision: https://reviews.llvm.org/D63155
llvm-svn: 363278
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r-- | clang/lib/CodeGen/BackendUtil.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index b311047c43f..ff4d3599fe7 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -60,6 +60,7 @@ #include "llvm/Transforms/Instrumentation/HWAddressSanitizer.h" #include "llvm/Transforms/Instrumentation/InstrProfiling.h" #include "llvm/Transforms/Instrumentation/MemorySanitizer.h" +#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h" #include "llvm/Transforms/Instrumentation/ThreadSanitizer.h" #include "llvm/Transforms/ObjCARC.h" #include "llvm/Transforms/Scalar.h" @@ -1216,6 +1217,11 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager( if (CodeGenOpts.OptimizationLevel == 0) addSanitizersAtO0(MPM, TargetTriple, LangOpts, CodeGenOpts); + + if (CodeGenOpts.hasProfileIRInstr()) { + // This file is stored as the ProfileFile. + MPM.addPass(PGOInstrumentationGenCreateVar(PGOOpt->ProfileFile)); + } } // FIXME: We still use the legacy pass manager to do code generation. We |