Commit Graph

16 Commits

Author SHA1 Message Date
Wenlei He 7c8a6936bf [Remarks] Add callsite locations to inline remarks
Summary:
Add call site location info into inline remarks so we can differentiate inline sites.
This can be useful for inliner tuning. We can also reconstruct full hierarchical inline
tree from parsing such remarks. The messege of inline remark is also tweaked so we can
differentiate SampleProfileLoader inline from CGSCC inline.

Reviewers: wmi, davidxl, hoy

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D82213
2020-06-20 23:32:10 -07:00
Leonard Chan e6d2c8dde6 [clang][NewPM] Fixing remaining -O0 tests that are broken under new PM
- CodeGen/flatten.c will fail under new PM becausec the new PM AlwaysInliner
  seems to intentionally inline functions but not call sites marked with
  alwaysinline (D23299)
- Tests that check remarks happen to check them for the inliner which is not
  turned on at O0. These tests just check that remarks work, but we can make
  separate tests for the new PM with -O1 so we can turn on the inliner and
  check the remarks with minimal changes.

Differential Revision: https://reviews.llvm.org/D62225

llvm-svn: 363846
2019-06-19 17:41:30 +00:00
Yevgeny Rouban 15b17d0a7c Provide reason messages for unviable inlining
InlineCost's isInlineViable() is changed to return InlineResult
instead of bool. This provides messages for failure reasons and
allows to get more specific messages for cases where callsites
are not viable for inlining.

Reviewed By: xbolva00, anemet

Differential Revision: https://reviews.llvm.org/D57089

llvm-svn: 352849
2019-02-01 10:44:43 +00:00
David Bolvansky eb3aad9935 Fix tests for changed opt remarks format
Summary:
Optimization remark format is slightly changed by LLVM patch D49412.
Two tests are fixed with expected messages changed.
Frankly speaking I have not tested this change yet. I will test when manage to setup the project.

Reviewers: xbolva00

Reviewed By: xbolva00

Subscribers: mehdi_amini, eraman, steven_wu, dexonsmith

Differential Revision: https://reviews.llvm.org/D50241

llvm-svn: 338971
2018-08-05 14:53:34 +00:00
Adam Nemet 2fcf58e933 Fix the second part of the broken comment from r306079
The driver-based test is still not identical to the front-end line, remove the
hotness threshold from there and add a new front-end based test with
threshold.

llvm-svn: 319578
2017-12-01 19:59:45 +00:00
Adam Nemet 2729a96bf7 Fix opt-remark with hotness testcase for sample-based PGO
1. Require hotness on all remark lines with -verify.

3. Fix the samplePGO file to actually produce hotness on each line.

The second remark has hotness 60 rather 30 which I don't quite understand but
testing this is strictly better than before.  It also unblocks the commit of
D40678.

llvm-svn: 319577
2017-12-01 19:59:42 +00:00
Adam Nemet 67be3529f2 Partially fix comment in test broken in r306079 and r306948
A RUN line was referring to the previous RUN line but a new test was added in
between them.  Just reorder the lines.

Note this still does not completely fix this the brokenness of the comment as
the driver-based test gained a new hotness-threshold argument in r306948 but
I'll fix that is a separate commit.

llvm-svn: 319576
2017-12-01 19:59:37 +00:00
Sam Elliott 2307905561 [clang] Fix tests for Emitting Single Inline Remark
Summary: This change depends on https://reviews.llvm.org/D36054 and should be landed at the same time.

Reviewers: anemet

Reviewed By: anemet

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D36949

llvm-svn: 311347
2017-08-21 16:40:35 +00:00
Brian Gesiak 562eab97ea Un-revert "[Driver] Add -fdiagnostics-hotness-threshold"
Summary:
Un-revert https://reviews.llvm.org/D34868, but with a slight tweak to the
documentation to fix an error -- I had used the wrong syntax for a link.

llvm-svn: 306948
2017-07-01 05:45:26 +00:00
Brian Gesiak 55e9c111b4 Revert "[Driver] Add -fdiagnostics-hotness-threshold"
Summary:
The commit caused a documentation breakage.

llvm-svn: 306946
2017-07-01 04:54:53 +00:00
Brian Gesiak dc6fa5d1f6 [Driver] Add -fdiagnostics-hotness-threshold
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

Reviewers: anemet, davidxl, hfinkel

Reviewed By: anemet

Subscribers: fhahn, cfe-commits

Differential Revision: https://reviews.llvm.org/D34868

llvm-svn: 306945
2017-07-01 04:44:38 +00:00
Brian Gesiak 0ea58886c4 [Frontend] 'Show hotness' can be used with a sampling profile
Summary:
Prior to this change, using `-fdiagnostics-show-hotness` with a sampling
profile specified via `-fprofile-sample-use=` would result in the Clang
frontend emitting a warning: "argument '-fdiagnostics-show-hotness' requires
profile-guided optimization information". Of course, a sampling profile
*is* profile-guided optimization information, so the warning is misleading.
Furthermore, despite the warning, hotness was displayed based on the data in
the sampling profile.

Prevent the warning from being emitted when a sampling profile is used, and
add a test that verifies this.

Reviewers: anemet, davidxl

Reviewed By: davidxl

Subscribers: danielcdh, cfe-commits

Differential Revision: https://reviews.llvm.org/D34082

llvm-svn: 306079
2017-06-23 02:38:45 +00:00
Adam Nemet 820086a20b Adjust tests after folding inlining analysis into missed remarks
llvm-svn: 293493
2017-01-30 16:22:50 +00:00
Adam Nemet 1eea3e577d Reapply r281276 with passing -emit-llvm in one of the tests
Original commit message:

Add -fdiagnostics-show-hotness

Summary:
I've recently added the ability for optimization remarks to include the
hotness of the corresponding code region.  This uses PGO and allows
filtering of the optimization remarks by relevance.  The idea was first
discussed here:
http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334

The general goal is to produce a YAML file with the remarks.  Then, an
external tool could dynamically filter these by hotness and perhaps by
other things.

That said it makes sense to also expose this at the more basic level
where we just include the hotness info with each optimization remark.
For example, in D22694, the clang flag was pretty useful to measure the
overhead of the additional analyses required to include hotness.
(Without the flag we don't even run the analyses.)

For the record, Hal has already expressed support for the idea of this
patch on IRC.

Differential Revision: https://reviews.llvm.org/D23284

llvm-svn: 281293
2016-09-13 04:32:40 +00:00
Adam Nemet f2b6883ac8 Revert "Add -fdiagnostics-show-hotness"
This reverts commit r281276.

Many bots are failing.

llvm-svn: 281279
2016-09-13 00:16:49 +00:00
Adam Nemet a340eff335 Add -fdiagnostics-show-hotness
Summary:
I've recently added the ability for optimization remarks to include the
hotness of the corresponding code region.  This uses PGO and allows
filtering of the optimization remarks by relevance.  The idea was first
discussed here:
http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334

The general goal is to produce a YAML file with the remarks.  Then, an
external tool could dynamically filter these by hotness and perhaps by
other things.

That said it makes sense to also expose this at the more basic level
where we just include the hotness info with each optimization remark.
For example, in D22694, the clang flag was pretty useful to measure the
overhead of the additional analyses required to include hotness.
(Without the flag we don't even run the analyses.)

For the record, Hal has already expressed support for the idea of this
patch on IRC.

Differential Revision: https://reviews.llvm.org/D23284

llvm-svn: 281276
2016-09-12 23:48:16 +00:00