diff options
author | Chen Zheng <czhengsz@cn.ibm.com> | 2024-06-20 22:20:07 -0400 |
---|---|---|
committer | Chen Zheng <czhengsz@cn.ibm.com> | 2024-06-20 22:26:52 -0400 |
commit | e1c03ddc9b03b820b421d8b3bca6a94e4d1a4675 (patch) | |
tree | 0ad8e7390f8e84ecd3646a3fa5f418205df0d13e /llvm/lib/Target/PowerPC | |
parent | abaaa48ce6b212798cc51f676f1d01d31d590120 (diff) | |
download | llvm-e1c03ddc9b03b820b421d8b3bca6a94e4d1a4675.zip llvm-e1c03ddc9b03b820b421d8b3bca6a94e4d1a4675.tar.gz llvm-e1c03ddc9b03b820b421d8b3bca6a94e4d1a4675.tar.bz2 |
[PowerPC] use r1 as the frame pointer when there is dynamic alloca
On PPC, when there is dynamic alloca, only r1 points to the backchain.
Diffstat (limited to 'llvm/lib/Target/PowerPC')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCFrameLowering.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp index 201b2d1..277d708 100644 --- a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp @@ -384,7 +384,10 @@ bool PPCFrameLowering::needsFP(const MachineFunction &MF) const { } void PPCFrameLowering::replaceFPWithRealFP(MachineFunction &MF) const { - bool is31 = needsFP(MF); + // When there is dynamic alloca in this function, we can not use the frame + // pointer X31/R31 for the frameaddress lowering. In this case, only X1/R1 + // always points to the backchain. + bool is31 = needsFP(MF) && !MF.getFrameInfo().hasVarSizedObjects(); unsigned FPReg = is31 ? PPC::R31 : PPC::R1; unsigned FP8Reg = is31 ? PPC::X31 : PPC::X1; |