[PATCH] D46232: [SystemZ, IPRA] determineCalleeSaves must always add return register and DP.
Jonas Paulsson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 29 03:18:17 PDT 2018
jonpa created this revision.
jonpa added reviewers: uweigand, qcolombet.
When enabling IPRA on SystemZ, a benchmark crashed and I found out that a function had been optimized to not save the Callee Saved Registers, which unfortunately included the return register (%r14) on SystemZ, so when the function tried to return UB resulted.
To fix this, I beleive SystemZFrameLowering::determineCalleeSaves() needs to add R14D to SavedRegs. I also think the DP should be added (https://reviews.llvm.org/source/libunwind/), in case the calling function uses DP, right?
In SystemZFrameLowering::determineCalleeSaves(), the first call to TargetFrameLowering::determineCalleeSaves(MF, SavedRegs, RS) will not add any registers to SavedRegs if
// When interprocedural register allocation is enabled caller saved registers
// are preferred over callee saved registers.
if (MF.getTarget().Options.EnableIPRA && isSafeForNoCSROpt(MF.getFunction()))
return;
So, the question then is what registers we must save in this case, and which we in fact do not have to save, to get better performance with IPRA. So far, I have come to the conclusion that all the specially treated registers that SystemZFrameLowering::determineCalleeSaves is already adding needs to be saved with IPRA.
I made two tests - one each for https://reviews.llvm.org/source/libunwind/ and R14. For some reason I could not process the debug output without doing a separate run for it.
https://reviews.llvm.org/D46232
Files:
lib/Target/SystemZ/SystemZFrameLowering.cpp
test/CodeGen/SystemZ/ipra-02.ll
test/CodeGen/SystemZ/ipra-03.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46232.144475.patch
Type: text/x-patch
Size: 10381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180429/e35e01cf/attachment.bin>
More information about the llvm-commits
mailing list