Extend and simplify the sample profile input file.

Press ? to show keyboard shortcuts.
Committed
dnovilloJan 10 2014, 3:23 PM
Parents
rL198972: Propagation of profile samples through the CFG.
Branches
Unknown
Tags
Unknown
Description

Extend and simplify the sample profile input file.

1- Use the line_iterator class to read profile files.

2- Allow comments in profile file. Lines starting with '#'

are completely ignored while reading the profile.

3- Add parsing support for discriminators and indirect call samples.

Our external profiler can emit more profile information that we are
currently not handling. This patch does not add new functionality to
support this information, but it allows profile files to provide it.

I will add actual support later on (for at least one of these
features, I need support for DWARF discriminators in Clang).

A sample line may contain the following additional information:

Discriminator. This is used if the sampled program was compiled with
DWARF discriminator support
(http://wiki.dwarfstd.org/index.php?title=Path_Discriminators). This
is currently only emitted by GCC and we just ignore it.

Potential call targets and samples. If present, this line contains a
call instruction. This models both direct and indirect calls. Each
called target is listed together with the number of samples. For
example,

                 130: 7  foo:3  bar:2  baz:7

The above means that at relative line offset 130 there is a call
instruction that calls one of foo(), bar() and baz(). With baz()
being the relatively more frequent call target.

Differential Revision: http://llvm-reviews.chandlerc.com/D2355

4- Simplify format of profile input file.

This implements earlier suggestions to simplify the format of the
sample profile file. The symbol table is not necessary and function
profiles do not need to know the number of samples in advance.

Differential Revision: http://llvm-reviews.chandlerc.com/D2419

rL198973

llvm/trunk/lib/Transforms/Scalar/SampleProfile.cpp

Loading...

llvm/trunk/test/Transforms/SampleProfile/Inputs/bad_fn_header.prof

Loading...

llvm/trunk/test/Transforms/SampleProfile/Inputs/bad_sample_line.prof

Loading...

llvm/trunk/test/Transforms/SampleProfile/Inputs/branch.prof

Loading...

llvm/trunk/test/Transforms/SampleProfile/Inputs/calls.prof

Loading...

llvm/trunk/test/Transforms/SampleProfile/Inputs/missing_num_syms.prof

Loading...

llvm/trunk/test/Transforms/SampleProfile/Inputs/missing_samples.prof

Loading...

llvm/trunk/test/Transforms/SampleProfile/Inputs/missing_symtab.prof

Loading...

llvm/trunk/test/Transforms/SampleProfile/Inputs/propagate.prof

Loading...

llvm/trunk/test/Transforms/SampleProfile/Inputs/syntax.prof

Loading...

llvm/trunk/test/Transforms/SampleProfile/calls.ll

Loading...

llvm/trunk/test/Transforms/SampleProfile/syntax.ll

Loading...

Add Comment