diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Passes/PassBuilder.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/Passes/PassRegistry.def | 1 | ||||
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp | 14 |
3 files changed, 15 insertions, 1 deletions
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 7ca5c7b7b3f..fca3e2534ed 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -50,6 +50,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/Regex.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Transforms/GCOVProfiler.h" #include "llvm/Transforms/IPO/ConstantMerge.h" #include "llvm/Transforms/IPO/ElimAvailExtern.h" #include "llvm/Transforms/IPO/ForceFunctionAttrs.h" diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def index fcc00bafcae..398da320171 100644 --- a/llvm/lib/Passes/PassRegistry.def +++ b/llvm/lib/Passes/PassRegistry.def @@ -43,6 +43,7 @@ MODULE_PASS("forceattrs", ForceFunctionAttrsPass()) MODULE_PASS("globaldce", GlobalDCEPass()) MODULE_PASS("globalopt", GlobalOptPass()) MODULE_PASS("inferattrs", InferFunctionAttrsPass()) +MODULE_PASS("insert-gcov-profiling", GCOVProfilerPass()) MODULE_PASS("internalize", InternalizePass()) MODULE_PASS("instrprof", InstrProfiling()) MODULE_PASS("invalidate<all>", InvalidateAllAnalysesPass()) diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp index f7ace857a37..9b19833cb75 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -14,7 +14,6 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Transforms/Instrumentation.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/Hashing.h" #include "llvm/ADT/STLExtras.h" @@ -35,6 +34,8 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Transforms/GCOVProfiler.h" +#include "llvm/Transforms/Instrumentation.h" #include "llvm/Transforms/Utils/ModuleUtils.h" #include <algorithm> #include <memory> @@ -464,6 +465,17 @@ bool GCOVProfiler::runOnModule(Module &M) { return false; } +PreservedAnalyses GCOVProfilerPass::run(Module &M, + AnalysisManager<Module> &AM) { + + GCOVProfiler Profiler(GCOVOpts); + + if (!Profiler.runOnModule(M)) + return PreservedAnalyses::all(); + + return PreservedAnalyses::none(); +} + static bool functionHasLines(Function &F) { // Check whether this function actually has any source lines. Not only // do these waste space, they also can crash gcov. |