This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO][C-API] Correct api comments
ClosedPublic

Authored by bd1976llvm on Dec 15 2017, 3:36 AM.

Details

Summary

Negative values never disabled the pruning - they simply set high values for the pruning interval.

Once https://reviews.llvm.org/D41231 lands the behaviour will be that negative values set the maximum pruning interval (which appears to have been the intention from the start).

I have adjusted the comments to reflect this, removed any inaccurate statements, and corrected any typos I spotted in the English.

Diff Detail

Repository
rL LLVM

Event Timeline

bd1976llvm created this revision.Dec 15 2017, 3:36 AM
tejohnson added inline comments.Dec 15 2017, 8:15 AM
include/llvm-c/lto.h
767 ↗(On Diff #127091)

I prefer leaving a note here about the value -1. You can note that it sets the largest possible pruning interval, effectively disabling it.

tejohnson added inline comments.Dec 15 2017, 8:16 AM
include/llvm-c/lto.h
767 ↗(On Diff #127091)

actually, a negative value, not just -1.

mehdi_amini added inline comments.Dec 15 2017, 9:46 AM
include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
152 ↗(On Diff #127091)

Why are you removing the indication about the default?

bd1976llvm added inline comments.Dec 15 2017, 10:15 AM
include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
152 ↗(On Diff #127091)

This was the original default but it was changed later and the comment was not updated. See: https://github.com/llvm-mirror/llvm/commit/f4c5ea4908a0d2f1e9adc793b74858dd3c69cc7a.

Updated patch to address review comments

bd1976llvm marked 4 inline comments as done.Dec 15 2017, 12:36 PM
This revision is now accepted and ready to land.Dec 15 2017, 12:57 PM
kromanova accepted this revision.Dec 15 2017, 3:24 PM
kromanova added inline comments.
include/llvm-c/lto.h
767 ↗(On Diff #127177)

It will be nice if you add one more clause in this sentence, explaining that this effectively disables pruning.

786 ↗(On Diff #127177)

It looks like we are setting the default values in CachePruning.h, so the comment "An unspecified default value" could be substituted with "Default value of 1200 seconds (20 minutes) is applied".

Obsolete comments are confusing. When I called this API in Sony's proprietary linker, I relied on this particular comment and end up doing initialization myself in my code. BTW, Ben, since I noticed it, we need to remove this initialization code I talked about from our (Sony's) proprietary linker.

kromanova added inline comments.Dec 15 2017, 3:42 PM
include/llvm-c/lto.h
786 ↗(On Diff #127177)

I would prefer mentioning one more time that negative values effectively disable pruning. Hopefully, after your change the umbrella comment above mentions it, but it will be nice to repeat it the comment directly related to this function.

787 ↗(On Diff #127177)

Also, a value of 0 is not ignored, but instead it forces the scan to occur. See comment in CachePruning.h

However, please do not make this change now, leave it "as is". I will send a patch a little later to accept 0 interval in thinlto_codegen_set_cache_pruning_function (as well as in 2 other APIs for setting relative size and expiration). I will do this change in the comment(s) at the same time as I do the functional change itself.

kromanova added inline comments.Dec 15 2017, 11:36 PM
include/llvm-c/lto.h
795 ↗(On Diff #127177)

Please apply the same changes as you did for thinlto_codegen_set_cache_pruning_interval
to the rest of thinLTO APIs responsible for pruning policy/incremental builds.
Otherwise, the comments look inconsistent.

E.g. for thinlto_codegen_set_final_cache_size_relative_to_available_space,
the following changes has to be made:

(1) across build -> across builds
(2) An unspecified default value will be applied -> Default is 75% (see comment in CachePruning.h)

include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
152 ↗(On Diff #127177)

Please mention one more time here that negative values effectively disable pruning

bd1976llvm marked 5 inline comments as done.Dec 18 2017, 9:43 AM
bd1976llvm added inline comments.
include/llvm-c/lto.h
786 ↗(On Diff #127177)

I can't change the unspecified default comment as this is part of the api i.e. these defaults might change in the future.

I will mention the "effectively disabling" in another review as this patch has already been accepted.

787 ↗(On Diff #127177)

Great - those new cache policies will be useful to customers.

795 ↗(On Diff #127177)

I can't change the unspecified default comment as this is part of the api i.e. these defaults might change in the future.

I will add the tidyups in another review as this patch has already been accepted.

include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
152 ↗(On Diff #127177)

I will mention the "effectively disabling" in another review as this patch has already been accepted.

mehdi_amini added inline comments.Dec 18 2017, 9:49 AM
include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
152 ↗(On Diff #127091)

Ah! Thanks :)

This revision was automatically updated to reflect the committed changes.
bd1976llvm marked 4 inline comments as done.