[PATCH] Fix AArch64 prologue for empty frame with dynamic allocas
Evgeniy Stepanov
eugenis at google.com
Tue Jun 30 15:40:25 PDT 2015
In http://reviews.llvm.org/D10826#197173, @t.p.northover wrote:
> I think there's more going on here that needs fixing too. For example if I add a simple "%tmp = alloca i8, i32 4" to your entry block I get the same assertion failure David mentioned in the PR (even with your patch).
>
> To me it looks like NeedsRealignment is misdefined, though that might not be the end of it. Elsewhere we used RegInfo->needsStackRealignment(MF), which looks like it would be an improvement, but doesn't actually fix the issue.
>
> Another possible problem in this area is that if NumBytes != 0, we end up realigning the stack twice: once in the prologue and once at the alloca. That's arguably a separate performance problem though.
Good point, thanks. This particular case is easy to fix by reusing the base register for scratchSPReg. This matches register reservation code in processFunctionBeforeCalleeSavedScan.
RegInfo->needsStackRealignment is also true in this case, and it has roughly the same meaning as getMaxAlignment, i.e. it does not take alloca scopes into account. This problem (extra re-alignment) is also present on i686 and x86_64 targets.
REPOSITORY
rL LLVM
http://reviews.llvm.org/D10826
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list