HomePhabricator

Add a counter-function insertion pass

Description

Add a counter-function insertion pass

As discussed in https://reviews.llvm.org/D22666, our current mechanism to
support -pg profiling, where we insert calls to mcount(), or some similar
function, is fundamentally broken. We insert these calls in the frontend, which
means they get duplicated when inlining, and so the accumulated execution
counts for the inlined-into functions are wrong.

Because we don't want the presence of these functions to affect optimizaton,
they should be inserted in the backend. Here's a pass which would do just that.
The knowledge of the name of the counting function lives in the frontend, so
we're passing it here as a function attribute. Clang will be updated to use
this mechanism.

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

Details

Committed
hfinkelSep 1 2016, 2:42 AM
Differential Revision
D22825: Add a counter-function insertion pass
Parents
rL280346: [www-pubs] Adding Archer paper
Branches
Unknown
Tags
Unknown