This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Add -fdiagnostics-hotness-threshold
ClosedPublic

Authored by modocache on Jun 29 2017, 11:36 PM.

Details

Summary

Depends on https://reviews.llvm.org/D34867.

Add a Clang frontend option to enable optimization remark hotness
thresholds, which were added to LLVM in https://reviews.llvm.org/D34867.
This prevents diagnostics that do not meet a minimum hotness
threshold from being output. When generating optimization remarks for large
codebases with a ton of cold code paths, this option can be used
to limit the optimization remark output at a reasonable size.
Discussion of this change can be read here:
http://lists.llvm.org/pipermail/llvm-dev/2017-June/114377.html

Event Timeline

modocache created this revision.Jun 29 2017, 11:36 PM
anemet edited edge metadata.Jun 30 2017, 5:10 AM

Great!

docs/UsersManual.rst
339–340

While you're here, could you please update this information. This option is implied by -fsave-optimization-record so it's not generally true that it's off by default.

include/clang/Basic/DiagnosticDriverKinds.td
197–201

Can you merge these two by taking the name of the option as the parameter %0?

include/clang/Driver/Options.td
728

Switch "hotness value" to "profile count"?

lib/Frontend/CompilerInvocation.cpp
908–920

There is no {} for single statement blocks.

test/Frontend/optimization-remark-with-hotness.c
9–20

I think that one of these (or additional tests) should also cover the default value (i.e. omitted -fdiagnostics-hotness-threshold=).

modocache updated this revision to Diff 104964.Jun 30 2017, 5:00 PM
modocache marked 4 inline comments as done.

Address comments, for the most part. As for the documentation: I think this is OK for now, but there are definitely a few more options that I'd like to document, and those will require updating some of the existing docs as well (one example that comes to mind is '-foptimization-record-file='). If it's alright with you, I'd like to do this in a future diff.

modocache marked an inline comment as done.Jun 30 2017, 5:01 PM
anemet accepted this revision.Jun 30 2017, 5:05 PM

Looks great, thank you!

This revision is now accepted and ready to land.Jun 30 2017, 5:05 PM
modocache closed this revision.Jun 30 2017, 9:44 PM

Awesome, thank you for all the reviews!