The offset calculation in ARMFrameLowering::ResolveFrameIndexReference for accessing local variables off a base pointer when both stack realignment and stack adjustment are needed looks to be incorrect. The stack adjustment is added onto the offset from the base pointer, which is already calculated and is fixed.
Compiling the following example (using -mcpu=cortex-a9 -fno-inline-functions) and running it will print out
1 2
instead of
1 1023.
#include <cstdio> struct A { int arr[2000]; }; struct alignas(16) B { int val; }; void bar(int &c, struct A) { c = 1023; } void init(A &a) { for (int i = 0; i < 2000; ++i) a.arr[i] = 0; } void init(B &b) { b.val = 2; } int main() { struct A big_struct; struct B small_struct = {2}; int val = 1; init(big_struct); init(small_struct); bar(val, big_struct); printf("%d %d\n", val, small_struct.val); return 0; }