Please add a comment as to why moving the TOC save to the prologue isn't to be done on AIX.
On ELFv2, we obviously didn't bother with 32-bit mode because it doesn't really exist. However, on AIX we should probably handle 32-bit mode as well and do this for PPC::STW as well. Then of course, we'll need to update PPCInstrInfo::isTOCSaveMI().
I think this is not actually not a fundamental limitation of the ABI itself? Can we make the comment more clear that "TOC save in prologue" is merely a strategy that hasn't been implemented for the AIX ABI code in LLVM?
LGTM with one minor comment and one idea about further improvement. Thanks for improving this.
Maybe it's better to use AIX64 as prefix comparing with below AIX32?
This should be out of this patch's scope, but we should have the opportunity to common TOCSave in block if.then and if.else to their common dominator block entry. Then we should only have one TOCSave in the final assembly.