Create constant expression casts instead of constant instructions if possible
[oota-llvm.git] / lib / CodeGen / PrologEpilogInserter.cpp
index b5715da242f9c3575cddedd3df77bd9603368c54..2f7f1f4ef30a8e49a595edf2f7d77333828912e0 100644 (file)
@@ -186,7 +186,7 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &Fn) {
   // Loop over all of the stack objects, assigning sequential addresses...
   MachineFrameInfo *FFI = Fn.getFrameInfo();
 
-  unsigned StackAlign = TFI.getStackAlignment();
+  unsigned StackAlignment = TFI.getStackAlignment();
 
   // Start at the beginning of the local area...
   int Offset = TFI.getOffsetOfLocalArea();
@@ -194,7 +194,7 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &Fn) {
     Offset += FFI->getObjectSize(i);         // Allocate Size bytes...
 
     unsigned Align = FFI->getObjectAlignment(i);
-    assert(Align < StackAlign && "Cannot align stack object to higher "
+    assert(Align <= StackAlignment && "Cannot align stack object to higher "
            "alignment boundary than the stack itself!");
     Offset = (Offset+Align-1)/Align*Align;   // Adjust to Alignment boundary...
     
@@ -221,7 +221,7 @@ void PEI::insertPrologEpilogCode(MachineFunction &Fn) {
   const TargetInstrInfo &TII = Fn.getTarget().getInstrInfo();
   for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) {
     // If last instruction is a return instruction, add an epilogue
-    if (TII.isReturn(I->back()->getOpcode()))
+    if (!I->empty() && TII.isReturn(I->back()->getOpcode()))
       Fn.getTarget().getRegisterInfo()->emitEpilogue(Fn, *I);
   }
 }