[llvm-commits] [llvm] r49064 - in /llvm/trunk: include/llvm/CodeGen/MachineModuleInfo.h lib/CodeGen/DwarfWriter.cpp lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/MachineModuleInfo.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/PowerPC/PPCAsmPrinter.cpp lib/Target/PowerPC/PPCRegisterInfo.cpp lib/Target/X86/X86ATTAsmPrinter.cpp lib/Target/X86/X86AsmPrinter.cpp lib/Target/X86/X86RegisterInfo.cpp

Dale Johannesen dalej at apple.com
Tue Apr 1 17:25:04 PDT 2008


Author: johannes
Date: Tue Apr  1 19:25:04 2008
New Revision: 49064

URL: http://llvm.org/viewvc/llvm-project?rev=49064&view=rev
Log:
Recommitting EH patch; this should answer most of the
review feedback.
-enable-eh is still accepted but doesn't do anything.
EH intrinsics use Dwarf EH if the target supports that,
and are handled by LowerInvoke otherwise.
The separation of the EH table and frame move data is,
I think, logically figured out, but either one still
causes full EH info to be generated (not sure how to
split the metadata correctly).
MachineModuleInfo::needsFrameInfo is no longer used and
is removed.


Modified:
    llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
    llvm/trunk/lib/CodeGen/DwarfWriter.cpp
    llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
    llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
    llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
    llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp
    llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp
    llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
    llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp

Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=49064&r1=49063&r2=49064&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Tue Apr  1 19:25:04 2008
@@ -1091,10 +1091,6 @@
   ///
   bool hasDebugInfo() const { return !CompileUnits.empty(); }
   
-  /// needsFrameInfo - Returns true if we need to gather callee-saved register
-  /// move info for the frame.
-  bool needsFrameInfo() const;
-
   bool callsEHReturn() const { return CallsEHReturn; }
   void setCallsEHReturn(bool b) { CallsEHReturn = b; }
 

Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=49064&r1=49063&r2=49064&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Tue Apr  1 19:25:04 2008
@@ -2777,10 +2777,22 @@
   };
 
   std::vector<FunctionEHFrameInfo> EHFrames;
-    
-  /// shouldEmit - Flag to indicate if debug information should be emitted.
-  ///
-  bool shouldEmit;
+
+  /// shouldEmitTable - Per-function flag to indicate if EH tables should
+  /// be emitted.
+  bool shouldEmitTable;
+
+  /// shouldEmitMoves - Per-function flag to indicate if frame moves info
+  /// should be emitted.
+  bool shouldEmitMoves;
+
+  /// shouldEmitTableModule - Per-module flag to indicate if EH tables
+  /// should be emitted.
+  bool shouldEmitTableModule;
+
+  /// shouldEmitFrameModule - Per-module flag to indicate if frame moves 
+  /// should be emitted.
+  bool shouldEmitMovesModule;
   
   /// EmitCommonEHFrame - Emit the common eh unwind frame.
   ///
@@ -3045,9 +3057,6 @@
   };
 
   void EmitExceptionTable() {
-    // Map all labels and get rid of any dead landing pads.
-    MMI->TidyLandingPads();
-
     const std::vector<GlobalVariable *> &TypeInfos = MMI->getTypeInfos();
     const std::vector<unsigned> &FilterIds = MMI->getFilterIds();
     const std::vector<LandingPadInfo> &PadInfos = MMI->getLandingPads();
@@ -3367,7 +3376,10 @@
   //
   DwarfException(std::ostream &OS, AsmPrinter *A, const TargetAsmInfo *T)
   : Dwarf(OS, A, T, "eh")
-  , shouldEmit(false)
+  , shouldEmitTable(false)
+  , shouldEmitMoves(false)
+  , shouldEmitTableModule(false)
+  , shouldEmitMovesModule(false)
   {}
   
   virtual ~DwarfException() {}
@@ -3387,48 +3399,59 @@
   /// EndModule - Emit all exception information that should come after the
   /// content.
   void EndModule() {
-    if (!shouldEmit) return;
-
-    const std::vector<Function *> Personalities = MMI->getPersonalities();
-    for (unsigned i =0; i < Personalities.size(); ++i)
-      EmitCommonEHFrame(Personalities[i], i);
-
-    for (std::vector<FunctionEHFrameInfo>::iterator I = EHFrames.begin(),
-           E = EHFrames.end(); I != E; ++I)
-      EmitEHFrame(*I);
+    if (shouldEmitMovesModule || shouldEmitTableModule) {
+      const std::vector<Function *> Personalities = MMI->getPersonalities();
+      for (unsigned i =0; i < Personalities.size(); ++i)
+        EmitCommonEHFrame(Personalities[i], i);
+
+      for (std::vector<FunctionEHFrameInfo>::iterator I = EHFrames.begin(),
+             E = EHFrames.end(); I != E; ++I)
+        EmitEHFrame(*I);
+    }
   }
 
   /// BeginFunction - Gather pre-function exception information.  Assumes being 
   /// emitted immediately after the function entry point.
   void BeginFunction(MachineFunction *MF) {
     this->MF = MF;
-    
-    if (MMI &&
-        ExceptionHandling &&
-        TAI->doesSupportExceptionHandling()) {
-      shouldEmit = true;
-      // Assumes in correct section after the entry point.
-      EmitLabel("eh_func_begin", ++SubprogramCount);
+    shouldEmitTable = shouldEmitMoves = false;
+    if (TAI->doesSupportExceptionHandling()) {
+
+      // Map all labels and get rid of any dead landing pads.
+      MMI->TidyLandingPads();
+      // If any landing pads survive, we need an EH table.
+      if (MMI->getLandingPads().size())
+        shouldEmitTable = true;
+
+      // See if we need frame move info.
+      if (MMI->hasDebugInfo() || !MF->getFunction()->doesNotThrow())
+        shouldEmitMoves = true;
+
+      if (shouldEmitMoves || shouldEmitTable)
+        // Assumes in correct section after the entry point.
+        EmitLabel("eh_func_begin", ++SubprogramCount);
     }
+    shouldEmitTableModule |= shouldEmitTable;
+    shouldEmitMovesModule |= shouldEmitMoves;
   }
 
   /// EndFunction - Gather and emit post-function exception information.
   ///
   void EndFunction() {
-    if (!shouldEmit) return;
-
-    EmitLabel("eh_func_end", SubprogramCount);
-    EmitExceptionTable();
-
-    // Save EH frame information
-    EHFrames.
-      push_back(FunctionEHFrameInfo(getAsm()->getCurrentFunctionEHName(MF),
+    if (shouldEmitMoves || shouldEmitTable) {
+      EmitLabel("eh_func_end", SubprogramCount);
+      EmitExceptionTable();
+
+      // Save EH frame information
+      EHFrames.
+        push_back(FunctionEHFrameInfo(getAsm()->getCurrentFunctionEHName(MF),
                                     SubprogramCount,
                                     MMI->getPersonalityIndex(),
                                     MF->getFrameInfo()->hasCalls(),
                                     !MMI->getLandingPads().empty(),
                                     MMI->getFrameMoves(),
                                     MF->getFunction()));
+      }
   }
 };
 

Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=49064&r1=49063&r2=49064&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Tue Apr  1 19:25:04 2008
@@ -19,6 +19,7 @@
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/CodeGen/Collector.h"
 #include "llvm/Target/TargetOptions.h"
+#include "llvm/Target/TargetAsmInfo.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Support/CommandLine.h"
 using namespace llvm;
@@ -66,7 +67,7 @@
   
   PM.add(createGCLoweringPass());
 
-  if (!ExceptionHandling)
+  if (!getTargetAsmInfo()->doesSupportExceptionHandling())
     PM.add(createLowerInvokePass(getTargetLowering()));
 
   // Make sure that no unreachable blocks are instruction selected.
@@ -192,7 +193,7 @@
   
   PM.add(createGCLoweringPass());
   
-  if (!ExceptionHandling)
+  if (!getTargetAsmInfo()->doesSupportExceptionHandling())
     PM.add(createLowerInvokePass(getTargetLowering()));
   
   // Make sure that no unreachable blocks are instruction selected.

Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=49064&r1=49063&r2=49064&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Tue Apr  1 19:25:04 2008
@@ -1583,12 +1583,6 @@
   }
 }
 
-/// needsFrameInfo - Returns true if we need to gather callee-saved register
-/// move info for the frame.
-bool MachineModuleInfo::needsFrameInfo() const {
-  return hasDebugInfo() || ExceptionHandling;
-}
-
 /// SetupCompileUnits - Set up the unique vector of compile units.
 ///
 void MachineModuleInfo::SetupCompileUnits(Module &M) {

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=49064&r1=49063&r2=49064&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Apr  1 19:25:04 2008
@@ -2827,22 +2827,18 @@
   }
     
   case Intrinsic::eh_exception: {
-    if (ExceptionHandling) {
-      if (!CurMBB->isLandingPad()) {
-        // FIXME: Mark exception register as live in.  Hack for PR1508.
-        unsigned Reg = TLI.getExceptionAddressRegister();
-        if (Reg) CurMBB->addLiveIn(Reg);
-      }
-      // Insert the EXCEPTIONADDR instruction.
-      SDVTList VTs = DAG.getVTList(TLI.getPointerTy(), MVT::Other);
-      SDOperand Ops[1];
-      Ops[0] = DAG.getRoot();
-      SDOperand Op = DAG.getNode(ISD::EXCEPTIONADDR, VTs, Ops, 1);
-      setValue(&I, Op);
-      DAG.setRoot(Op.getValue(1));
-    } else {
-      setValue(&I, DAG.getConstant(0, TLI.getPointerTy()));
-    }
+    if (!CurMBB->isLandingPad()) {
+      // FIXME: Mark exception register as live in.  Hack for PR1508.
+      unsigned Reg = TLI.getExceptionAddressRegister();
+      if (Reg) CurMBB->addLiveIn(Reg);
+    }
+    // Insert the EXCEPTIONADDR instruction.
+    SDVTList VTs = DAG.getVTList(TLI.getPointerTy(), MVT::Other);
+    SDOperand Ops[1];
+    Ops[0] = DAG.getRoot();
+    SDOperand Op = DAG.getNode(ISD::EXCEPTIONADDR, VTs, Ops, 1);
+    setValue(&I, Op);
+    DAG.setRoot(Op.getValue(1));
     return 0;
   }
 
@@ -2852,7 +2848,7 @@
     MVT::ValueType VT = (Intrinsic == Intrinsic::eh_selector_i32 ?
                          MVT::i32 : MVT::i64);
     
-    if (ExceptionHandling && MMI) {
+    if (MMI) {
       if (CurMBB->isLandingPad())
         addCatchInfo(I, MMI, CurMBB);
       else {
@@ -2902,7 +2898,7 @@
   case Intrinsic::eh_return: {
     MachineModuleInfo *MMI = DAG.getMachineModuleInfo();
 
-    if (MMI && ExceptionHandling) {
+    if (MMI) {
       MMI->setCallsEHReturn(true);
       DAG.setRoot(DAG.getNode(ISD::EH_RETURN,
                               MVT::Other,
@@ -2925,32 +2921,27 @@
    }
 
    case Intrinsic::eh_dwarf_cfa: {
-     if (ExceptionHandling) {
-       MVT::ValueType VT = getValue(I.getOperand(1)).getValueType();
-       SDOperand CfaArg;
-       if (MVT::getSizeInBits(VT) > MVT::getSizeInBits(TLI.getPointerTy()))
-         CfaArg = DAG.getNode(ISD::TRUNCATE,
-                              TLI.getPointerTy(), getValue(I.getOperand(1)));
-       else
-         CfaArg = DAG.getNode(ISD::SIGN_EXTEND,
-                              TLI.getPointerTy(), getValue(I.getOperand(1)));
-       
-       SDOperand Offset = DAG.getNode(ISD::ADD,
-                                      TLI.getPointerTy(),
-                                      DAG.getNode(ISD::FRAME_TO_ARGS_OFFSET,
-                                                  TLI.getPointerTy()),
-                                      CfaArg);
-       setValue(&I, DAG.getNode(ISD::ADD,
-                                TLI.getPointerTy(),
-                                DAG.getNode(ISD::FRAMEADDR,
-                                            TLI.getPointerTy(),
-                                            DAG.getConstant(0,
-                                                            TLI.getPointerTy())),
-                                Offset));
-     } else {
-       setValue(&I, DAG.getConstant(0, TLI.getPointerTy()));
-     }
-
+     MVT::ValueType VT = getValue(I.getOperand(1)).getValueType();
+     SDOperand CfaArg;
+     if (MVT::getSizeInBits(VT) > MVT::getSizeInBits(TLI.getPointerTy()))
+       CfaArg = DAG.getNode(ISD::TRUNCATE,
+                            TLI.getPointerTy(), getValue(I.getOperand(1)));
+     else
+       CfaArg = DAG.getNode(ISD::SIGN_EXTEND,
+                            TLI.getPointerTy(), getValue(I.getOperand(1)));
+
+     SDOperand Offset = DAG.getNode(ISD::ADD,
+                                    TLI.getPointerTy(),
+                                    DAG.getNode(ISD::FRAME_TO_ARGS_OFFSET,
+                                                TLI.getPointerTy()),
+                                    CfaArg);
+     setValue(&I, DAG.getNode(ISD::ADD,
+                              TLI.getPointerTy(),
+                              DAG.getNode(ISD::FRAMEADDR,
+                                          TLI.getPointerTy(),
+                                          DAG.getConstant(0,
+                                                          TLI.getPointerTy())),
+                              Offset));
      return 0;
   }
 
@@ -3176,7 +3167,7 @@
     Args.push_back(Entry);
   }
 
-  if (LandingPad && ExceptionHandling && MMI) {
+  if (LandingPad && MMI) {
     // Insert a label before the invoke call to mark the try range.  This can be
     // used to detect deletion of the invoke via the MachineModuleInfo.
     BeginLabel = MMI->NextLabelID();
@@ -3195,7 +3186,7 @@
     setValue(CS.getInstruction(), Result.first);
   DAG.setRoot(Result.second);
 
-  if (LandingPad && ExceptionHandling && MMI) {
+  if (LandingPad && MMI) {
     // Insert a label at the end of the invoke call to mark the try range.  This
     // can be used to detect deletion of the invoke via the MachineModuleInfo.
     EndLabel = MMI->NextLabelID();
@@ -4614,11 +4605,10 @@
 
   FunctionLoweringInfo FuncInfo(TLI, Fn, MF);
 
-  if (ExceptionHandling)
-    for (Function::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I)
-      if (InvokeInst *Invoke = dyn_cast<InvokeInst>(I->getTerminator()))
-        // Mark landing pad.
-        FuncInfo.MBBMap[Invoke->getSuccessor(1)]->setIsLandingPad();
+  for (Function::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I)
+    if (InvokeInst *Invoke = dyn_cast<InvokeInst>(I->getTerminator()))
+      // Mark landing pad.
+      FuncInfo.MBBMap[Invoke->getSuccessor(1)]->setIsLandingPad();
 
   for (Function::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I)
     SelectBasicBlock(I, MF, FuncInfo);
@@ -4757,7 +4747,7 @@
 
   MachineModuleInfo *MMI = DAG.getMachineModuleInfo();
 
-  if (ExceptionHandling && MMI && BB->isLandingPad()) {
+  if (MMI && BB->isLandingPad()) {
     // Add a label to mark the beginning of the landing pad.  Deletion of the
     // landing pad can thus be detected via the MachineModuleInfo.
     unsigned LabelID = MMI->addLandingPad(BB);

Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=49064&r1=49063&r2=49064&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Tue Apr  1 19:25:04 2008
@@ -1086,8 +1086,9 @@
 
   O << "\n";
 
-  if (ExceptionHandling && TAI->doesSupportExceptionHandling() && MMI) {
+  if (TAI->doesSupportExceptionHandling() && MMI) {
     // Add the (possibly multiple) personalities to the set of global values.
+    // Only referenced functions get into the Personalities list.
     const std::vector<Function *>& Personalities = MMI->getPersonalities();
 
     for (std::vector<Function *>::const_iterator I = Personalities.begin(),

Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=49064&r1=49063&r2=49064&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Tue Apr  1 19:25:04 2008
@@ -20,6 +20,7 @@
 #include "PPCFrameInfo.h"
 #include "PPCSubtarget.h"
 #include "llvm/Constants.h"
+#include "llvm/Function.h"
 #include "llvm/Type.h"
 #include "llvm/CodeGen/ValueTypes.h"
 #include "llvm/CodeGen/MachineInstrBuilder.h"
@@ -946,6 +947,8 @@
   MachineBasicBlock::iterator MBBI = MBB.begin();
   MachineFrameInfo *MFI = MF.getFrameInfo();
   MachineModuleInfo *MMI = MFI->getMachineModuleInfo();
+  bool needsFrameInfo = (MMI && MMI->hasDebugInfo()) ||
+       !MF.getFunction()->doesNotThrow();
   
   // Prepare for frame info.
   unsigned FrameLabelId = 0;
@@ -1019,7 +1022,7 @@
   unsigned TargetAlign = MF.getTarget().getFrameInfo()->getStackAlignment();
   unsigned MaxAlign = MFI->getMaxAlignment();
 
-  if (MMI && MMI->needsFrameInfo()) {
+  if (needsFrameInfo) {
     // Mark effective beginning of when frame pointer becomes valid.
     FrameLabelId = MMI->NextLabelID();
     BuildMI(MBB, MBBI, TII.get(PPC::LABEL)).addImm(FrameLabelId).addImm(0);
@@ -1095,7 +1098,7 @@
     }
   }
   
-  if (MMI && MMI->needsFrameInfo()) {
+  if (needsFrameInfo) {
     std::vector<MachineMove> &Moves = MMI->getFrameMoves();
     
     if (NegFrameSize) {

Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=49064&r1=49063&r2=49064&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Tue Apr  1 19:25:04 2008
@@ -150,8 +150,9 @@
        F->getLinkage() == Function::WeakLinkage))
     O << "Lllvm$workaround$fake$stub$" << CurrentFnName << ":\n";
 
-  if (TAI->doesSupportDebugInformation()) {
-    // Emit pre-function debug information.
+  if (TAI->doesSupportDebugInformation() ||
+      TAI->doesSupportExceptionHandling()) {
+    // Emit pre-function debug and/or EH information.
     DW.BeginFunction(&MF);
   }
 

Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=49064&r1=49063&r2=49064&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Tue Apr  1 19:25:04 2008
@@ -381,9 +381,9 @@
 
     O << "\n";
 
-    if (ExceptionHandling && TAI->doesSupportExceptionHandling() && MMI &&
-        !Subtarget->is64Bit()) {
+    if (TAI->doesSupportExceptionHandling() && MMI && !Subtarget->is64Bit()) {
       // Add the (possibly multiple) personalities to the set of global values.
+      // Only referenced functions get into the Personalities list.
       const std::vector<Function *>& Personalities = MMI->getPersonalities();
 
       for (std::vector<Function *>::const_iterator I = Personalities.begin(),

Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=49064&r1=49063&r2=49064&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Tue Apr  1 19:25:04 2008
@@ -504,6 +504,7 @@
   MachineModuleInfo *MMI = MFI->getMachineModuleInfo();
   X86MachineFunctionInfo *X86FI = MF.getInfo<X86MachineFunctionInfo>();
   MachineBasicBlock::iterator MBBI = MBB.begin();
+  bool needsFrameInfo = (MMI && MMI->hasDebugInfo()) || !Fn->doesNotThrow();
   
   // Prepare for frame info.
   unsigned FrameLabelId = 0;
@@ -536,7 +537,7 @@
       .addReg(FramePtr);
     NumBytes -= SlotSize;
 
-    if (MMI && MMI->needsFrameInfo()) {
+    if (needsFrameInfo) {
       // Mark effective beginning of when frame pointer becomes valid.
       FrameLabelId = MMI->NextLabelID();
       BuildMI(MBB, MBBI, TII.get(X86::LABEL)).addImm(FrameLabelId).addImm(0);
@@ -548,7 +549,7 @@
   }
   
   unsigned ReadyLabelId = 0;
-  if (MMI && MMI->needsFrameInfo()) {
+  if (needsFrameInfo) {
     // Mark effective beginning of when frame pointer is ready.
     ReadyLabelId = MMI->NextLabelID();
     BuildMI(MBB, MBBI, TII.get(X86::LABEL)).addImm(ReadyLabelId).addImm(0);
@@ -607,7 +608,7 @@
     }
   }
 
-  if (MMI && MMI->needsFrameInfo()) {
+  if (needsFrameInfo) {
     std::vector<MachineMove> &Moves = MMI->getFrameMoves();
     const TargetData *TD = MF.getTarget().getTargetData();
 





More information about the llvm-commits mailing list