This is an archive of the discontinued LLVM Phabricator instance.

[llvm][NFC] Cleanup uses of std::function in Inlining-related APIs
ClosedPublic

Authored by mtrofin on May 13 2020, 5:45 PM.

Details

Summary

Replacing uses of std::function pointers or refs, or Optional, to
function_ref, since the usage pattern allows that. If the function is
optional, using a default parameter value (nullptr). This led to a few
parameter reshufles, to push all optionals to the end of the parameter
list.

Diff Detail

Event Timeline

mtrofin created this revision.May 13 2020, 5:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 13 2020, 5:45 PM
dblaikie accepted this revision.May 14 2020, 7:00 PM

Looks good at a glance to me - welcome to make changes like that without review in the future.

llvm/lib/Transforms/Utils/InlineFunction.cpp
1907–1910

Aside: This set of {} seems sort of arbitrary - given the larger for loop outside this doesn't use {} and the ifs inside don't... why this particular level of nesting with {}? Could remove those in a separate patch if you like

2498

This still seems to have unnecessary parentheses, instead: &IFI.GetAssumptionCache(*Caller) should be fine. (few other cases of similarly unnecessary () in other similar places in this file you could remove, since you're moving them around anyway)

This revision is now accepted and ready to land.May 14 2020, 7:00 PM
mtrofin marked 2 inline comments as done.May 14 2020, 10:16 PM
This revision was automatically updated to reflect the committed changes.