[AArch64] Fix issues with large arrays on stack
authorKiran Chandramohan <kiran.chandramohan@arm.com>
Wed, 20 Nov 2019 12:45:26 +0000 (12:45 +0000)
committerKiran Chandramohan <kiran.chandramohan@arm.com>
Tue, 10 Dec 2019 11:44:41 +0000 (11:44 +0000)
commit965ed1e974e80e0b96ac3921e8a915e8e46baa5c
tree978976b5372c4ec27c485dbbdd5d18e2547b44ca
parentb2508ce85c1e39cd32e8bb1071297d5840a32541
[AArch64] Fix issues with large arrays on stack

Summary:
This patch fixes a few issues when large arrays are allocated on the
stack. Currently, clang has inconsistent behaviour, for debug builds
there is an assertion failure when the array size on stack is around 2GB
but there is no assertion when the stack is around 8GB. For release
builds there is no assertion, the compilation succeeds but generates
incorrect code. The incorrect code generated is due to using
int/unsigned int instead of their 64-bit counterparts. This patch,
1) Removes the assertion in frame legality check.
2) Converts int/unsigned int in some places to the 64-bit variants. This
helps in generating correct code and removes the inconsistent behaviour.
3) Adds a test which runs without optimisations.

Reviewers: sdesmalen, efriedma, fhahn, aemerson

Reviewed By: efriedma

Subscribers: eli.friedman, fpetrogalli, kristof.beyls, hiraditya,
llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70496
llvm/include/llvm/CodeGen/MachineFrameInfo.h
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/lib/CodeGen/MachineFrameInfo.cpp
llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
llvm/lib/Target/AArch64/AArch64FrameLowering.h
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h
llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
llvm/test/CodeGen/AArch64/large-stack.ll [new file with mode: 0644]