This is an archive of the discontinued LLVM Phabricator instance.

[ARM] prologue instructions emitted for naked function with >64 byte argument
ClosedPublic

Authored by simonwallis2 on May 28 2020, 5:42 AM.

Details

Summary

The naked function attribute is meant to suppress all function
prologue/epilogue instructions.

On ARM, some are still emitted if an argument greater than 64 bytes in size
(the threshold for using the byval attribute in IR) is passed partially
in registers.

Perform the check for Attribute::Naked and early exit in
SelectionDAGISel::LowerArguments().

Checking in ARMFrameLowering::determineCalleeSaves() is too late.

A test case is included.

Diff Detail

Event Timeline

simonwallis2 created this revision.May 28 2020, 5:42 AM
This revision is now accepted and ready to land.Jun 4 2020, 12:31 PM
This revision was automatically updated to reflect the committed changes.

I notice this change caused a regression described in https://bugs.llvm.org/show_bug.cgi?id=47708 . I guess there is something in the LowerArguments that is actually needed for the naked functions. I am not familiar with the SelectionDAGISel implementation nor to how to iterate and try fixes that will not require a 1h+ compilation. If someone could guide I can try to fix this. But more importantly, I would like to get pass the regression so I can update llvm to 11 in the crystal language.

To describe how unfamiliar I am with this: I bisected between 11.0.0 and 11-init, which took 13 iterations with 1h+ and 20gb each step. I don't know better. I checked that reverting this change on top of 11.0.0 fixes the issue.