[PATCH] D14558: [llvm-profdata] Add check for text profile formats and improve error reporting

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 10 22:31:19 PST 2015


Looks good, but if the message is augmented to be something like the
following:

error: foo.profdata: Malformed instrumented profile data. Perhaps you
forgot to use -sample option?

would make it even more friendlier.

thanks,

David

On Tue, Nov 10, 2015 at 4:33 PM, Nathan Slingerland <slingn at gmail.com>
wrote:

> slingn created this revision.
> slingn added reviewers: dnovillo, bogner, davidxl.
> slingn added a subscriber: llvm-commits.
>
> This change addresses two possible instances of user error / confusion when
> merging sampled profile data.
>
> Previously any input that didn't match the raw or processed instrumented
> format
> would automatically be interpreted as instrumented profile text format
> data.
> No error would be reported during the merge.
>
> Example:
> If foo-sampled.profdata and bar-sampled.profdata are binary sampled
> profiles:
>
> Old behavior:
> $ llvm-profdata merge foo-sampled.profdata bar-sampled.profdata -output
> foobar-sampled.profdata
> $ llvm-profdata show -sample foobar-sampled.profdata
> error: foobar-sampled.profdata:1: Expected 'mangled_name:NUM:NUM', found
> lprofi
>
> This change adds basic checks for plain ASCII input data when assuming text
> input. It also makes error messages related to file format validity more
> specific about the assumbed profile data type.
>
> New behavior:
> $ llvm-profdata merge foo-sampled.profdata bar-sampled.profdata -output
> foobar-sampled.profdata
> error: foo.profdata: Malformed instrumented profile data
>
> http://reviews.llvm.org/D14558
>
> Files:
>   include/llvm/ProfileData/InstrProfReader.h
>   include/llvm/ProfileData/SampleProfReader.h
>   lib/ProfileData/InstrProf.cpp
>   lib/ProfileData/InstrProfReader.cpp
>   lib/ProfileData/SampleProf.cpp
>   lib/ProfileData/SampleProfReader.cpp
>   test/tools/llvm-profdata/raw-magic-but-no-header.test
>   test/tools/llvm-profdata/text-format-errors.test
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151110/84c76e46/attachment.html>


More information about the llvm-commits mailing list