This is an archive of the discontinued LLVM Phabricator instance.

[SystemZ] implement adjustInliningThreshold()
ClosedPublic

Authored by jonpa on Mar 9 2022, 2:19 PM.

Details

Summary

This patch boosts the inlining threshold for a particular type of functions that are using an incoming argument only as a memcpy source.

Diff Detail

Event Timeline

jonpa created this revision.Mar 9 2022, 2:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2022, 2:19 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
jonpa requested review of this revision.Mar 9 2022, 2:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2022, 2:19 PM
uweigand accepted this revision.Mar 9 2022, 2:25 PM

LGTM, thanks!

This revision is now accepted and ready to land.Mar 9 2022, 2:25 PM
jonpa updated this revision to Diff 414226.Mar 9 2022, 3:22 PM

Maybe add a test as well?

jonpa added inline comments.Mar 9 2022, 3:24 PM
llvm/test/CodeGen/SystemZ/inline-thresh-adjust.ll
2

This doesn't check that a particular function is actually inlined, but it can at least make sure that this type of function gets a boosted threshold, so maybe it could still be used, or?

uweigand added inline comments.Mar 10 2022, 4:27 AM
llvm/test/CodeGen/SystemZ/inline-thresh-adjust.ll
2

How stable are these particular numbers (1012, 1687)? I don't think it would be a good idea to hard-code those in a test case if they change randomly with any codegen change?

If we want to test whether the function is inlined, can't we simply verify whether the function name symbol does not exist in the output (because the function was completely eliminated)?

jonpa added inline comments.Mar 10 2022, 5:59 AM
llvm/test/CodeGen/SystemZ/inline-thresh-adjust.ll
2

They may change I guess, but the test case is only running the inliner pass and nothing else, so it would not be sensitive to any codegen change.

I think those numbers may change if the inliner heuristics are modified but I was hoping that then it would be trivial to update the test.

I could also try to use the original function and check that it gets inlined, but that may be a little tricky as the cost is adjusted per the context of the call-site. I guess I could just reduce the original imagick file.

jonpa marked an inline comment as done.Mar 10 2022, 6:00 AM
jonpa updated this revision to Diff 422478.Apr 13 2022, 4:50 AM

Test updated to avoid hard coded values.

jonpa requested review of this revision.Apr 13 2022, 4:51 AM
uweigand accepted this revision.Apr 13 2022, 4:56 AM

See inline comment. Otherwise LGTM. Thanks!

llvm/test/CodeGen/SystemZ/inline-thresh-adjust.ll
12

Maybe also allow wildcards for the cost.

This revision is now accepted and ready to land.Apr 13 2022, 4:56 AM
This revision was landed with ongoing or failed builds.Apr 13 2022, 5:49 AM
This revision was automatically updated to reflect the committed changes.