Page MenuHomePhabricator

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

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



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

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

A test case is included.

Diff Detail

Unit TestsFailed

3,910 msLLVM.CodeGen/AVR::Unknown Unit Message ("")
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang/llvm-project/build/bin/llc -mattr=avr6,sram < /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang/llvm-project/llvm/test/CodeGen/AVR/return.ll -march=avr | /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang/llvm-project/llvm/test/CodeGen/AVR/return.ll
150 msLLVM.CodeGen/AVR::Unknown Unit Message ("")
Script: -- : 'RUN: at line 1'; c:\ws\prod\llvm-project\build\bin\llc.exe -mattr=avr6,sram < C:\ws\prod\llvm-project\llvm\test\CodeGen\AVR\return.ll -march=avr | c:\ws\prod\llvm-project\build\bin\filecheck.exe C:\ws\prod\llvm-project\llvm\test\CodeGen\AVR\return.ll

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 . 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.