[PATCH] D23734: Add -fprofile-dir= to clang.

Nick Lewycky via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 18:17:59 PDT 2016


nlewycky created this revision.
nlewycky added subscribers: llvm-commits, cfe-commits.

-fprofile-dir=path allows the user to specify where .gcda files should be emitted when the program is run. In particular, this is the first flag that causes the .gcno and .o files to have different paths, LLVM is extended to support this. -fprofile-dir= does not change the file name in the .gcno (and thus where lcov looks for the source) but it does change the name in the .gcda (and thus where the runtime library writes the .gcda file). It's different from a GCOV_PREFIX because a user can observe that the GCOV_PREFIX_STRIP will strip paths off of -fprofile-dir= but not off of a supplied GCOV_PREFIX.

To implement this we split -coverage-file into -coverage-data-file and -coverage-notes-file to specify the two different names. The !llvm.gcov metadata node grows from a 2-element form {string coverage-file, node dbg.cu} to 3-elements, {string coverage-notes-file, string coverage-data-file, node dbg.cu}. In the 3-element form, the file name is already "mangled" with .gcno/.gcda suffixes, while the 2-element form left that to the middle end pass.

https://reviews.llvm.org/D23734

Files:
  lib/Transforms/Instrumentation/GCOVProfiling.cpp
  test/Transforms/GCOVProfiling/three-element-mdnode.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23734.68753.patch
Type: text/x-patch
Size: 4477 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160820/42127478/attachment.bin>


More information about the llvm-commits mailing list