Initialize {Min|Max}CSFrameIndex properly.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 7 Dec 2006 02:25:34 +0000 (02:25 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 7 Dec 2006 02:25:34 +0000 (02:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32299 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/PrologEpilogInserter.cpp

index 5a18b920fc9b3ce29bbe119e3635c1f9847b1535..9bcc6f2a4364c0d8e52817357d174ae24d97c6b8 100644 (file)
@@ -115,6 +115,10 @@ void PEI::calculateCalleeSavedRegisters(MachineFunction &Fn) {
   int FrameSetupOpcode   = RegInfo->getCallFrameSetupOpcode();
   int FrameDestroyOpcode = RegInfo->getCallFrameDestroyOpcode();
 
+  // These are used to keep track the callee-save area. Initialize them.
+  MinCSFrameIndex = INT_MAX;
+  MaxCSFrameIndex = 0;
+
   // Early exit for targets which have no callee saved registers and no call
   // frame setup/destroy pseudo instructions.
   if ((CSRegs == 0 || CSRegs[0] == 0) &&
@@ -174,8 +178,6 @@ void PEI::calculateCalleeSavedRegisters(MachineFunction &Fn) {
 
   // Now that we know which registers need to be saved and restored, allocate
   // stack slots for them.
-  MinCSFrameIndex = INT_MAX;
-  MaxCSFrameIndex = 0;
   for (unsigned i = 0, e = CSI.size(); i != e; ++i) {
     unsigned Reg = CSI[i].getReg();
     const TargetRegisterClass *RC = CSI[i].getRegClass();