TargetRegisterClass specifies the desired spill alignment. However, it cannot be...
authorEvan Cheng <evan.cheng@apple.com>
Thu, 28 Sep 2006 18:52:32 +0000 (18:52 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 28 Sep 2006 18:52:32 +0000 (18:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30648 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/PrologEpilogInserter.cpp

index 81d9724be42e6b7219c239507b82a22cda25e566..5a18b920fc9b3ce29bbe119e3635c1f9847b1535 100644 (file)
@@ -190,7 +190,12 @@ void PEI::calculateCalleeSavedRegisters(MachineFunction &Fn) {
     int FrameIdx;
     if (FixedSlot == FixedSpillSlots+NumFixedSpillSlots) {
       // Nope, just spill it anywhere convenient.
-      FrameIdx = FFI->CreateStackObject(RC->getSize(), RC->getAlignment());
+      unsigned Align = RC->getAlignment();
+      unsigned StackAlign = TFI->getStackAlignment();
+      // We may not be able to sastify the desired alignment specification of
+      // the TargetRegisterClass if the stack alignment is smaller. Use the min.
+      Align = std::min(Align, StackAlign);
+      FrameIdx = FFI->CreateStackObject(RC->getSize(), Align);
       if ((unsigned)FrameIdx < MinCSFrameIndex) MinCSFrameIndex = FrameIdx;
       if ((unsigned)FrameIdx > MaxCSFrameIndex) MaxCSFrameIndex = FrameIdx;
     } else {