[llvm] [PowerPC]optimize the epilogue for restore non volatile cr fields (PR #202339)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 9 09:14:27 PDT 2026
================
@@ -1768,6 +1769,22 @@ void PPCFrameLowering::emitEpilogue(MachineFunction &MF,
}
}
assert(RBReg != ScratchReg && "Should have avoided ScratchReg");
+
+ auto BuildMoveToCR = [&]() {
+ assert(!Subtarget.is32BitELFABI() && "Non 32 Bit ELF ABI only.");
+ if (MustSaveCRs.size() == 1) {
+ // In Non 32 Bit ELF ABI, we are not required to restore all CR fields.
+ // If only one CR field was clobbered, use mtocrf to selectively
+ // restore just that field.
+ BuildMI(MBB, MBBI, dl, MoveToSingleCRInst, MustSaveCRs[0])
+ .addReg(TempReg, getKillRegState(true));
+ } else {
+ BuildMI(MBB, MBBI, dl, MoveToCRInst)
+ .addImm(255)
----------------
RolandF77 wrote:
^^ Un-addressed comment.
https://github.com/llvm/llvm-project/pull/202339
More information about the llvm-commits
mailing list