summaryrefslogtreecommitdiff
path: root/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCFrameLowering.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCFrameLowering.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
index 201b2d162372..277d708013c7 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;