This is an archive of the discontinued LLVM Phabricator instance.

[Inlining] Delete redundant optnone/alwaysinline check
ClosedPublic

Authored by lxfind on Jan 21 2021, 4:39 PM.

Details

Summary

The same check is done in InlineCost: https://github.com/llvm/llvm-project/blob/8b0bd54d0ec968df28ccc58bbb537a7b7c074ef2/llvm/lib/Analysis/InlineCost.cpp#L2537-L2552
Also, doing a check on the callee here is confusing, because anything that deals with callee should be done in the inner loop where we proecss all calls from the same caller.

Diff Detail

Event Timeline

lxfind created this revision.Jan 21 2021, 4:39 PM
lxfind requested review of this revision.Jan 21 2021, 4:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 21 2021, 4:39 PM
aeubanks accepted this revision.Jan 21 2021, 4:59 PM

I've thought about doing this a couple times already :)

This revision is now accepted and ready to land.Jan 21 2021, 4:59 PM

The same check is done in InlineCost: https://github.com/llvm/llvm-project/blob/8b0bd54d0ec968df28ccc58bbb537a7b7c074ef2/llvm/lib/Analysis/InlineCost.cpp#L2537-L2552

The check in InlineCost is on Caller, so it's not strictly redundant.

On the other hand, I expect this to be captured as incompatible attributes (caller without it, but callee has it), so removing the check here should be fine.

The same check is done in InlineCost: https://github.com/llvm/llvm-project/blob/8b0bd54d0ec968df28ccc58bbb537a7b7c074ef2/llvm/lib/Analysis/InlineCost.cpp#L2537-L2552

The check in InlineCost is on Caller, so it's not strictly redundant.

It checks both there:

if (Call.hasFnAttr(Attribute::AlwaysInline)) ...
...
if (Caller->hasOptNone())
wenlei accepted this revision.Jan 21 2021, 5:12 PM

Ah, you're right.. sorry for confusion..

This revision was landed with ongoing or failed builds.Jan 21 2021, 6:38 PM
This revision was automatically updated to reflect the committed changes.