LLVMInstrumentation requires MC since r223532.
[oota-llvm.git] / lib / Transforms / Instrumentation / GCOVProfiling.cpp
index 220d7f8b490824fb5f7422ab1d857d6c8e93ee4c..685428ee952e1519fdcc95eeb9724d0e9798e81c 100644 (file)
@@ -310,11 +310,15 @@ namespace {
 
       Function *F = SP.getFunction();
       DEBUG(dbgs() << "Function: " << getFunctionName(SP) << "\n");
-      uint32_t i = 0;
-      for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
+
+      Function::iterator BB = F->begin(), E = F->end();
+      Blocks[BB++] = new GCOVBlock(0, os);
+      ReturnBlock = new GCOVBlock(1, os);
+
+      uint32_t i = 2;
+      for (; BB != E; ++BB) {
         Blocks[BB] = new GCOVBlock(i++, os);
       }
-      ReturnBlock = new GCOVBlock(i++, os);
 
       std::string FunctionNameAndLine;
       raw_string_ostream FNLOS(FunctionNameAndLine);