This patch should go into google/main so that relative paths can be used with FDO. ...
14 years, 2 months ago
(2011-03-28 17:11:35 UTC)
#1
This patch should go into google/main so that relative paths can be
used with FDO.
Bootstraped without regression and verified that my benchmarks correctly
used the generated profiles.
Original patch to trunk included a regression test, but I noticed last
week that it failed in certain test scenarios. Will investigate and
push the change upstream once I resolve that.
Thanks,
Martin
2011-03-28 Martin Thuresson <martint@google.com>
* gcc/doc/invoke.texi: Document support for relative profile paths.
* gcc/libgcov.c (gcov_exit): Support relative profile paths.
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi (revision 171049)
+++ gcc/doc/invoke.texi (working copy)
@@ -7774,7 +7774,7 @@ Set the directory to search for the prof
This option affects only the profile data generated by
@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
-and its related options.
+and its related options. Both absolute and relative can be used.
By default, GCC will use the current directory as @var{path}, thus the
profile data file will appear in the same directory as the object file.
Index: gcc/libgcov.c
===================================================================
--- gcc/libgcov.c (revision 171049)
+++ gcc/libgcov.c (working copy)
@@ -283,8 +283,9 @@ gcov_exit (void)
}
}
/* Update complete filename with stripped original. */
- if (!IS_DIR_SEPARATOR (*fname) && !HAS_DRIVE_SPEC(fname))
+ if (prefix_length != 0 && !IS_DIR_SEPARATOR (*fname))
{
+ /* If prefix is given, add directory separator. */
strcpy (gi_filename_up, "/");
strcpy (gi_filename_up + 1, fname);
}
--
This patch is available for review at http://codereview.appspot.com/4280074
OK. A nit and a question below. Diego. http://codereview.appspot.com/4280074/diff/1/gcc/doc/invoke.texi File gcc/doc/invoke.texi (right): http://codereview.appspot.com/4280074/diff/1/gcc/doc/invoke.texi#newcode7777 gcc/doc/invoke.texi:7777: and ...
14 years, 2 months ago
(2011-03-28 17:59:32 UTC)
#2
http://codereview.appspot.com/4280074/diff/1/gcc/doc/invoke.texi File gcc/doc/invoke.texi (right): http://codereview.appspot.com/4280074/diff/1/gcc/doc/invoke.texi#newcode7777 gcc/doc/invoke.texi:7777: and its related options. Both absolute and relative can ...
14 years, 2 months ago
(2011-03-28 18:14:19 UTC)
#3
On Mon, Mar 28, 2011 at 14:14, <martint@google.com> wrote: > On 2011/03/28 17:59:32, Diego Novillo ...
14 years, 2 months ago
(2011-03-28 19:47:48 UTC)
#4
On Mon, Mar 28, 2011 at 14:14, <martint@google.com> wrote:
> On 2011/03/28 17:59:32, Diego Novillo wrote:
>>
>> I'm confused. why did you take !HAS_DRIVE_SPEC() out?
>
> Earlier in the function, the following code makes sure we don't start
> the fname with a DRIVE_SPEC.
>
> if (prefix_length != 0 && HAS_DRIVE_SPEC(fname))
> fname += 2;
Ah, quite right. Thanks.
Diego.
Issue 4280074: [google] Allow relative profile paths.
Created 14 years, 2 months ago by martint
Modified 14 years, 2 months ago
Reviewers: Diego Novillo
Base URL: svn://gcc.gnu.org/svn/gcc/branches/google/main/
Comments: 4