[llvm] r233578 - Bitcode: Reflow code to use early continues, NFC

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Mar 30 11:29:18 PDT 2015


Author: dexonsmith
Date: Mon Mar 30 13:29:18 2015
New Revision: 233578

URL: http://llvm.org/viewvc/llvm-project?rev=233578&view=rev
Log:
Bitcode: Reflow code to use early continues, NFC

Modified:
    llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp

Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=233578&r1=233577&r2=233578&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Mon Mar 30 13:29:18 2015
@@ -2106,24 +2106,27 @@ static void WriteFunction(const Function
       // If the instruction has a debug location, emit it.
       DebugLoc DL = I->getDebugLoc();
       if (DL.isUnknown()) {
-        // nothing todo.
-      } else if (DL == LastDL) {
+        continue;
+      }
+
+      if (DL == LastDL) {
         // Just repeat the same debug loc as last time.
         Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC_AGAIN, Vals);
-      } else {
-        MDNode *Scope, *IA;
-        DL.getScopeAndInlinedAt(Scope, IA, I->getContext());
-        assert(Scope && "Expected valid scope");
+        continue;
+      }
 
-        Vals.push_back(DL.getLine());
-        Vals.push_back(DL.getCol());
-        Vals.push_back(VE.getMetadataOrNullID(Scope));
-        Vals.push_back(VE.getMetadataOrNullID(IA));
-        Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC, Vals);
-        Vals.clear();
+      MDNode *Scope, *IA;
+      DL.getScopeAndInlinedAt(Scope, IA, I->getContext());
+      assert(Scope && "Expected valid scope");
 
-        LastDL = DL;
-      }
+      Vals.push_back(DL.getLine());
+      Vals.push_back(DL.getCol());
+      Vals.push_back(VE.getMetadataOrNullID(Scope));
+      Vals.push_back(VE.getMetadataOrNullID(IA));
+      Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC, Vals);
+      Vals.clear();
+
+      LastDL = DL;
     }
 
   // Emit names for all the instructions etc.





More information about the llvm-commits mailing list