Revert r146997, "Heed spill slot alignment on ARM."
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 3 Jan 2012 22:34:35 +0000 (22:34 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 3 Jan 2012 22:34:35 +0000 (22:34 +0000)
This patch caused a miscompilation of oggenc because a frame pointer was
suddenly needed halfway through register allocation.

<rdar://problem/10625436>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147487 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMBaseInstrInfo.cpp
lib/Target/ARM/ARMBaseRegisterInfo.cpp
test/CodeGen/ARM/fast-isel-deadcode.ll
test/CodeGen/Thumb2/aligned-spill.ll

index 13f1e664516d6ec7ef546a8568528bc5643dc1ba..dfd9c40710652fc5f8083fabcad8335f580bdbfd 100644 (file)
@@ -765,8 +765,7 @@ storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
       break;
     case 16:
       if (ARM::QPRRegClass.hasSubClassEq(RC)) {
-        // Use aligned spills if the stack can be realigned.
-        if (Align >= 16 && getRegisterInfo().canRealignStack(MF)) {
+        if (Align >= 16 && getRegisterInfo().needsStackRealignment(MF)) {
           AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::VST1q64Pseudo))
                      .addFrameIndex(FI).addImm(16)
                      .addReg(SrcReg, getKillRegState(isKill))
@@ -915,7 +914,7 @@ loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
     break;
   case 16:
     if (ARM::QPRRegClass.hasSubClassEq(RC)) {
-      if (Align >= 16 && getRegisterInfo().canRealignStack(MF)) {
+      if (Align >= 16 && getRegisterInfo().needsStackRealignment(MF)) {
         AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::VLD1q64Pseudo), DestReg)
                      .addFrameIndex(FI).addImm(16)
                      .addMemOperand(MMO));
index 44efb6a761eef657999beb6c41c3e60f55ca3fdf..9c91bcc307501c9a15ae351cdcf7372a2f9bd605 100644 (file)
@@ -542,7 +542,7 @@ needsStackRealignment(const MachineFunction &MF) const {
   const MachineFrameInfo *MFI = MF.getFrameInfo();
   const Function *F = MF.getFunction();
   unsigned StackAlign = MF.getTarget().getFrameLowering()->getStackAlignment();
-  bool requiresRealignment = ((MFI->getMaxAlignment() > StackAlign) ||
+  bool requiresRealignment = ((MFI->getLocalFrameMaxAlign() > StackAlign) ||
                                F->hasFnAttr(Attribute::StackAlignment));
 
   return requiresRealignment && canRealignStack(MF);
index 7e147c7b4d7dfc5b740648cc62da38be2714a1fe..1d77975ee86891dc03e4028e1330d99df511a82c 100644 (file)
@@ -15,7 +15,8 @@ entry:
 ; THUMB-NOT: sxtb
 ; THUMB: movs r0, #0
 ; THUMB: movt r0, #0
-; THUMB: pop
+; THUMB: add sp, #32
+; THUMb: pop {r7, pc}
   ret i32 0
 }
 
index 948c8ce2c2d72123976314c7de544d59668a2fa7..734003273e113b8f1e65c462f94fb73fa19f2e4c 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mcpu=cortex-a8 | FileCheck %s
+; DONT: llc < %s -mcpu=cortex-a8 | FileCheck %s
 ; RUN: llc < %s -mcpu=cortex-a8 -align-neon-spills | FileCheck %s --check-prefix=NEON
 target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
 target triple = "thumbv7-apple-ios"