This is an archive of the discontinued LLVM Phabricator instance.

[inliner] Mandatory inlining decisions produce remarks
ClosedPublic

Authored by mtrofin on Sep 30 2021, 4:16 PM.

Details

Summary

This also removes the need to disable the mandatory inlining phase in
tests.

In a departure from the previous remark, we don't output a 'cost' in
this case, because there's no such thing. We just report that inlining
happened because of the attribute.

Diff Detail

Event Timeline

mtrofin created this revision.Sep 30 2021, 4:16 PM
mtrofin requested review of this revision.Sep 30 2021, 4:16 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptSep 30 2021, 4:16 PM
wenlei added inline comments.Oct 1 2021, 10:49 AM
llvm/lib/Analysis/InlineAdvisor.cpp
52

curious why do we need anonymous namespace here?

mtrofin marked an inline comment as done.Oct 1 2021, 10:54 AM
mtrofin added inline comments.
llvm/lib/Analysis/InlineAdvisor.cpp
52

iiuc it's preferred we place file-local types inside an anonymous namespace.

Looking now at the style guideline, it touts their benefits but also says I should have only placed de decl there and the impl of those members out... but the members are quite trivial. Happy to move them out though.

wenlei accepted this revision.Oct 1 2021, 10:58 AM

lgtm, thanks.

llvm/lib/Analysis/InlineAdvisor.cpp
52

Thanks for the pointer. I don't have a strong opinion but slightly leaning towards moving out of anonymous namespace be consistent with how other InlineAdvice is organized (DefaultInlineAdvice, MLInlineAdvice not in anonymous namespace).

This revision is now accepted and ready to land.Oct 1 2021, 10:58 AM
aeubanks added inline comments.Oct 1 2021, 11:03 AM
llvm/lib/Analysis/InlineAdvisor.cpp
72–89

can we add a test for these?

mtrofin marked 3 inline comments as done.Oct 1 2021, 11:08 AM
mtrofin added inline comments.
llvm/lib/Analysis/InlineAdvisor.cpp
52

Ah, those are public (i.e. in a .h file)

72–89

I think that would be tricky, because they should not actually happen - the way we determine whether a site is alwaysinlinable checks (but not thoroughly) for legality. Let me see if I can find a regression test. It may be we can synthesize such a case in IR only, though, so not much of a help for the frontend tests?

dblaikie added inline comments.
llvm/lib/Analysis/InlineAdvisor.cpp
52

Generally if a type is declared/defined inside a .cpp file it should be in an anonymous namespace so it can't collide with other implementation type names in other .cpp files. (& .cpp-local functions should be static or in an anonymous namespace for the same reason)

Looks like the other two (DefaultInlineAdvice and MLInlineAdvice) are defined in headers, so they must not be in anonymous namespaces.

aeubanks added inline comments.Oct 1 2021, 11:35 AM
llvm/lib/Analysis/InlineAdvisor.cpp
72–89

yeah some IR tests is what I was thinking

mtrofin updated this revision to Diff 377091.Oct 4 2021, 10:39 PM
mtrofin marked 2 inline comments as done.

added test

mtrofin marked an inline comment as done.Oct 4 2021, 10:41 PM
mtrofin added inline comments.
llvm/lib/Analysis/InlineAdvisor.cpp
72–89

Done. The 'unattempted' case is really an assert, but got a test for the attempted but failed.

aeubanks accepted this revision.Oct 5 2021, 1:44 PM

lg, thanks!

This revision was automatically updated to reflect the committed changes.
mtrofin marked an inline comment as done.