Index: llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp =================================================================== --- llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -844,7 +844,6 @@ continue; // TODO: Functions using scope-based EH are currently not supported. if (isUsingScopeBasedEH(F)) continue; - if (!Result) Result = true; DenseMap, unsigned> EdgeToCounter; unsigned Edges = 0; @@ -868,6 +867,8 @@ "__llvm_gcov_ctr"); CountersBySP.push_back(std::make_pair(Counters, SP)); + Result = true; + // If a BB has several predecessors, use a PHINode to select // the correct counter. for (auto &BB : F) { @@ -939,6 +940,7 @@ Builder.CreateRetVoid(); appendToGlobalCtors(*M, F, 0); + Result = true; } return Result;