[PATCH] D37091: Expose -mllvm -accurate-sample-profile to clang.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 24 11:57:49 PDT 2017


rsmith added inline comments.


================
Comment at: docs/ClangCommandLineReference.rst:173-180
+.. option:: -faccurate-sample-profile, -fno-accurate-sample-profile
+.. program:: clang
+
+If the sample profile is accurate, callsites without profile samples are marked
+as cold. Otherwise, treat un-sampled callsites as if we have no profile. This
+option can be used to enable more aggressive size optimization based on
+profiles.
----------------
This is a generated file; please don't modify it by hand.


================
Comment at: include/clang/Driver/Options.td:590
 def faccess_control : Flag<["-"], "faccess-control">, Group<f_Group>;
+def faccurate_sample_profile : Flag<["-"], "faccurate-sample-profile">,
+  Group<f_Group>, Flags<[DriverOption, CC1Option]>,
----------------
We generally try to group similar options together under a common prefix. Would `-fprofile-sample-accurate` work here?


================
Comment at: include/clang/Driver/Options.td:592-594
+  HelpText<"If sample profile is accurate, we will mark all un-sampled "
+           "callsite as cold. Otherwise, treat callsites without profile "
+           "samples as if we have no profile">;
----------------
`HelpText` should be a very brief string that can be included in a one-line description of the flag for `--help`. Longer text for inclusion in the option reference should be in a `DocBrief<{blah blah blah.}>`.

Also, it seems to me that this help text doesn't actually say what the option does. Does this request that accurate sample profiles be generated, or specify that an accurate sample profile was provided, or what? Suggestion:

```
HelpText<"Specifies that the sample profile is accurate">,
DocBrief<{Specifies that the sample profile is accurate. If the sample profile is accurate, callsites without profile samples are marked as cold. [...same as current reference documentation text...]}>
```


https://reviews.llvm.org/D37091





More information about the cfe-commits mailing list