On subtargets that have a red zone, we will copy the stack pointer to the base pointer in the prologue prior to updating the stack pointer. As far as I can tell, there are no other updates to the base pointer after that. This suggests that we should be able to restore the stack pointer from the base pointer rather than loading it from the back chain or adding the frame size back to either the stack pointer or the frame pointer.
This came about because functions that call setjmp need to restore the SP from the FP because the back chain might have been clobbered (see https://reviews.llvm.org/D92906). However, if the stack is realigned, the restored SP might be incorrect (which is what caused the failures in the two ASan test cases).
With this patch, there are no failures on any code I have tried nor do I see a problem with using the BP since it is a callee-saved register that does not get updated in the function.
@hfinkel I am really hoping that you can comment on the viability of this patch since you're more familiar with the concept of the base pointer. I haven't really been able to track down much in the way of documentation for it and it is not mentioned in the ABI so it seems to be specific to LLVM.