[PATCH] D64360: [llvm-profdata] Handle the cases of overlapping input file and output file

Rong Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 8 12:03:50 PDT 2019


xur created this revision.
xur added a reviewer: davidxl.
Herald added a project: LLVM.

Currently llvm-profdata does not expect the same file name for the input profile
and the output profile.
 >llvm-profdata merge A.profraw B.profraw -o B.profraw
The above command runs successfully but the resulted B.profraw is not correct.
This patch fixes the issue by moving the initialization of writer after loading
the profile.

For the show command, the following will report a confusing error of
"Empty raw profile file":
 >llvm-profdata show B.profraw -o B.profraw
It's harder to fix as we need to output something before loading the input profile.
I don't think that a fix for this is worth the effort. I just make the error explicit for
 the show command.


https://reviews.llvm.org/D64360

Files:
  llvm/test/tools/llvm-profdata/Inputs/same-name-1.proftext
  llvm/test/tools/llvm-profdata/Inputs/same-name-2.proftext
  llvm/test/tools/llvm-profdata/Inputs/same-name-3.proftext
  llvm/test/tools/llvm-profdata/Inputs/same-name-4.proftext
  llvm/test/tools/llvm-profdata/same-filename.test
  llvm/tools/llvm-profdata/llvm-profdata.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64360.208472.patch
Type: text/x-patch
Size: 5447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190708/476ee560/attachment.bin>


More information about the llvm-commits mailing list