Slightly simplify code in DwarfDebug::beginFunction
authorAlexey Samsonov <samsonov@google.com>
Wed, 30 Apr 2014 21:44:17 +0000 (21:44 +0000)
committerAlexey Samsonov <samsonov@google.com>
Wed, 30 Apr 2014 21:44:17 +0000 (21:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207710 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp

index e0bc4bd723956c80c51922ecda77eafba9aa6bf1..8de084abff1e9ad51624fdae6587d6ad009d9b89 100644 (file)
@@ -1440,9 +1440,8 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
   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 MachineFunction *MF) {
             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();
       }
     }
   }