]> granicus.if.org Git - clang/commitdiff
Create SampleProfileLoader pass in llvm instead of clang
authorDehao Chen <dehao@google.com>
Wed, 14 Dec 2016 16:49:34 +0000 (16:49 +0000)
committerDehao Chen <dehao@google.com>
Wed, 14 Dec 2016 16:49:34 +0000 (16:49 +0000)
Summary:
We used to create SampleProfileLoader pass in clang. This makes LTO/ThinLTO unable to add this pass in the linker plugin. This patch moves the SampleProfileLoader pass creation from
clang to llvm pass manager builder.

Reviewers: tejohnson, davidxl, dnovillo

Subscribers: mehdi_amini, cfe-commits

Differential Revision: https://reviews.llvm.org/D27744

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289670 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/BackendUtil.cpp

index cef7485446af66a4315f659e16a7f2d04adc9e06..0b72dc93932e7b35efae0039488126daac647fe1 100644 (file)
@@ -464,10 +464,8 @@ void EmitAssemblyHelper::CreatePasses(legacy::PassManager &MPM,
   if (CodeGenOpts.hasProfileIRUse())
     PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath;
 
-  if (!CodeGenOpts.SampleProfileFile.empty()) {
-    MPM.add(createPruneEHPass());
-    MPM.add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile));
-  }
+  if (!CodeGenOpts.SampleProfileFile.empty())
+    PMBuilder.PGOSampleUse = CodeGenOpts.SampleProfileFile;
 
   PMBuilder.populateFunctionPassManager(FPM);
   PMBuilder.populateModulePassManager(MPM);