This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Inline callee if its target-features are a subset of the caller
ClosedPublic

Authored by fhahn on Jun 27 2017, 9:59 AM.

Details

Summary

Similar to X86, it should be safe to inline callees if their target-features
are a subset of the caller. This change matches GCC's inlining behavior
with respect to attributes [1].

[1] https://gcc.gnu.org/onlinedocs/gcc/AArch64-Function-Attributes.html#AArch64-Function-Attributes

Diff Detail

Event Timeline

fhahn created this revision.Jun 27 2017, 9:59 AM

There don't appear to be any negative tests here (i.e. you could replace the function with "return true" and nothing would fail). Other than that, I think it's OK for the existing features. We're going to have to watch out in future though: +strict-align could easily have been implemented as +no-strict-align for example.

The test checks that the call to bar at line 24 in qux is not inlined, because bar has +crypto as additional target-feature. I think that should fail if we replace the function with return true.

Agreed that we have to keep the areInlineCompatible function in mind when adding new attributes that require stricter rules. In the patch for ARM (D34697) I've added a special check for thumb-mode.

t.p.northover accepted this revision.Jun 27 2017, 1:44 PM

Apologies, I misread the CHECK-LABEL line as the test by mistake. Looks good to me!

This revision is now accepted and ready to land.Jun 27 2017, 1:44 PM
fhahn closed this revision.Jun 27 2017, 3:27 PM
fhahn added a comment.Jun 28 2017, 1:52 AM

Thanks for the quick review :)