There is no need to write a local utility routine to find subprogram info if the...
[oota-llvm.git] / lib / Transforms / Instrumentation / GCOVProfiling.cpp
index 089c8b9876116c1e6fe4970b676d53508b744501..16262932936a5b7b160f35bad19f65a8bf66c8bb 100644 (file)
@@ -109,15 +109,6 @@ ModulePass *llvm::createGCOVProfilerPass(bool EmitNotes, bool EmitData,
   return new GCOVProfiler(EmitNotes, EmitData, Use402Format);
 }
 
-static DISubprogram findSubprogram(DIScope Scope) {
-  while (!Scope.isSubprogram()) {
-    assert(Scope.isLexicalBlock() &&
-           "Debug location not lexical block or subprogram");
-    Scope = DILexicalBlock(Scope).getContext();
-  }
-  return DISubprogram(Scope);
-}
-
 namespace {
   class GCOVRecord {
    protected:
@@ -403,7 +394,7 @@ void GCOVProfiler::emitGCNO() {
             if (Loc.isUnknown()) continue;
             if (Line == Loc.getLine()) continue;
             Line = Loc.getLine();
-            if (SP != findSubprogram(DIScope(Loc.getScope(*Ctx)))) continue;
+            if (SP != getDISubprogram(Loc.getScope(*Ctx))) continue;
             
             GCOVLines &Lines = Block.getFile(SP.getFilename());
             Lines.addLine(Loc.getLine());