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)
commit70b07510806a70e83f5324e47a50786e6e6ddc0c
tree32ba2ebb2de539c1256516d26c5fc2f240013e78
parent23cf05ab9e2a5970ff9ee367d2f4af0a60285b49
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223672 91177308-0d34-0410-b5e6-96231b3b80d8
14 files changed:
docs/LangRef.rst
include/llvm/IR/IntrinsicInst.h
include/llvm/IR/Intrinsics.td
include/llvm/InitializePasses.h
include/llvm/LinkAllPasses.h
include/llvm/Transforms/Instrumentation.h
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/Transforms/Instrumentation/CMakeLists.txt
lib/Transforms/Instrumentation/InstrProfiling.cpp [new file with mode: 0644]
lib/Transforms/Instrumentation/Instrumentation.cpp
test/Instrumentation/InstrProfiling/no-counters.ll [new file with mode: 0644]
test/Instrumentation/InstrProfiling/noruntime.ll [new file with mode: 0644]
test/Instrumentation/InstrProfiling/platform.ll [new file with mode: 0644]
test/Instrumentation/InstrProfiling/profiling.ll [new file with mode: 0644]