[llvm-dev] option similar to -finstrument-functions but for code blocks

Peng Yu via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 24 08:27:39 PST 2019

On Thu, Jan 24, 2019 at 10:19 AM David Greene <dag at cray.com> wrote:
> Peng Yu via llvm-dev <llvm-dev at lists.llvm.org> writes:
> > I'd like to track not just at the function level, but also at the code
> > block level. For example, for a if-else statement, I want to know when
> > the if-branch or else-branch is enter/exit.
> >
> > Is there a clang option similar to -finstrument-functions for code blocks?
> Are you looking for code coverage or profile information (block
> execution counts)?  Dean already replied with the code coverage
> information.

Not really. I don't care really the number of times an instruction is
called. I care about the control flow and I'd like to visualize it as
a graph. cfg is static. I'd like something dynamic which only shows
what is run.

Of course, having the additional information about the count should be
fine. But it is secondary.

> LLVM has a profile instrumentation pass which is run with
> opt -profile-generate.  This is gprof-style profiling.  I don't know
> offhand which (if any) clang option is hooked up to -profile-generate.
>                            -David


More information about the llvm-dev mailing list