This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Implement targetHandlesStackFrameRounding to prevent stack over-allocation
AbandonedPublic

Authored by lenary on Aug 8 2019, 10:09 AM.

Details

Reviewers
asb
Summary

TargetFrameLowering contains a callback for telling LLVM that a target
will do its own stack frame size rounding. This defaults to false.

In the RISC-V backend, we have been doing our own stack frame size rounding,
without overriding this callback. This has been leading to over-allocation,
which this patch aims to mitigate. In almost all cases of aligned objects on the
stack, stack usage has decreased.

Event Timeline

lenary created this revision.Aug 8 2019, 10:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2019, 10:09 AM
lenary planned changes to this revision.Aug 9 2019, 3:04 AM
asb added a comment.Aug 9 2019, 3:20 AM

This causes failures on the GCC torture suite:

$ cat output_rv64imafdc_lp64_O0/runfail 
920501-8
991216-1
991216-2
complex-7
multi-ix
pr27073
pr64979
struct-ret-1
va-arg-10
va-arg-12
va-arg-15
va-arg-16
va-arg-17
va-arg-18
va-arg-19
va-arg-1
va-arg-22
va-arg-23
va-arg-24
va-arg-2
va-arg-5
va-arg-6
va-arg-9
$ cat output_rv32imafdc_ilp32_O0/runfail
920501-8
991216-1
991216-2
multi-ix
pr23324
pr27073
pr44942
pr64979
stdarg-4
va-arg-10
va-arg-15
va-arg-19
va-arg-22
va-arg-24
va-arg-2
va-arg-6
va-arg-9

Fewer failures at higher optimisation levels.

lenary abandoned this revision.Jul 1 2020, 4:57 AM