[llvm] r207710 - Slightly simplify code in DwarfDebug::beginFunction

Alexey Samsonov samsonov at google.com
Wed Apr 30 14:44:17 PDT 2014


Author: samsonov
Date: Wed Apr 30 16:44:17 2014
New Revision: 207710

URL: http://llvm.org/viewvc/llvm-project?rev=207710&view=rev
Log:
Slightly simplify code in DwarfDebug::beginFunction

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=207710&r1=207709&r2=207710&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Apr 30 16:44:17 2014
@@ -1440,9 +1440,8 @@ void DwarfDebug::beginFunction(const Mac
   Asm->OutStreamer.EmitLabel(FunctionBeginSym);
 
   // Collect user variables, find the end of the prologue.
-  for (MachineFunction::const_iterator I = MF->begin(), E = MF->end(); I != E;
-       ++I) {
-    for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end();
+  for (const auto &MBB : *MF) {
+    for (MachineBasicBlock::const_iterator II = MBB.begin(), IE = MBB.end();
          II != IE; ++II) {
       const MachineInstr *MI = II;
       if (MI->isDebugValue()) {
@@ -1454,12 +1453,11 @@ void DwarfDebug::beginFunction(const Mac
             std::make_pair(Var, SmallVector<const MachineInstr *, 4>()));
         if (IterPair.second)
           UserVariables.push_back(Var);
-      } else {
+      } else if (!MI->getFlag(MachineInstr::FrameSetup) &&
+                 PrologEndLoc.isUnknown() && !MI->getDebugLoc().isUnknown()) {
         // First known non-DBG_VALUE and non-frame setup location marks
         // the beginning of the function body.
-        if (!MI->getFlag(MachineInstr::FrameSetup) &&
-            (PrologEndLoc.isUnknown() && !MI->getDebugLoc().isUnknown()))
-          PrologEndLoc = MI->getDebugLoc();
+        PrologEndLoc = MI->getDebugLoc();
       }
     }
   }





More information about the llvm-commits mailing list