InstrProf: An intrinsic and lowering for instrumentation based profiling
authorJustin Bogner <mail@justinbogner.com>
Mon, 8 Dec 2014 18:02:35 +0000 (18:02 +0000)
committerJustin Bogner <mail@justinbogner.com>
Mon, 8 Dec 2014 18:02:35 +0000 (18:02 +0000)
commit61ba2e3996120a08deef823dccd7e8d8cd9c4332
tree668a13811cf59ae9a9f96442aa0e51cd4153eb9e
parent05917fa60041518d5dc30eb4301fec8483dadb17
InstrProf: An intrinsic and lowering for instrumentation based profiling

Introduce the ``llvm.instrprof_increment`` intrinsic and the
``-instrprof`` pass. These provide the infrastructure for writing
counters for profiling, as in clang's ``-fprofile-instr-generate``.

The implementation of the instrprof pass is ported directly out of the
CodeGenPGO classes in clang, and with the followup in clang that rips
that code out to use these new intrinsics this ends up being NFC.

Doing the instrumentation this way opens some doors in terms of
improving the counter performance. For example, this will make it
simple to experiment with alternate lowering strategies, and allows us
to try handling profiling specially in some optimizations if we want
to.

Finally, this drastically simplifies the frontend and puts all of the
lowering logic in one place.

llvm-svn: 223672
14 files changed:
llvm/docs/LangRef.rst
llvm/include/llvm/IR/IntrinsicInst.h
llvm/include/llvm/IR/Intrinsics.td
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/LinkAllPasses.h
llvm/include/llvm/Transforms/Instrumentation.h
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/Transforms/Instrumentation/CMakeLists.txt
llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp [new file with mode: 0644]
llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
llvm/test/Instrumentation/InstrProfiling/no-counters.ll [new file with mode: 0644]
llvm/test/Instrumentation/InstrProfiling/noruntime.ll [new file with mode: 0644]
llvm/test/Instrumentation/InstrProfiling/platform.ll [new file with mode: 0644]
llvm/test/Instrumentation/InstrProfiling/profiling.ll [new file with mode: 0644]