[PATCH] D51619: [gcov] Fix branch counters with switch statements
calixte via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 11 10:12:35 PDT 2018
calixte added inline comments.
================
Comment at: lib/Transforms/Instrumentation/GCOVProfiling.cpp:630
bool Result = false;
- bool InsertIndCounterIncrCode = false;
for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) {
SmallVector<std::pair<GlobalVariable *, MDNode *>, 8> CountersBySP;
----------------
vsk wrote:
> Reading through the diff I noticed that this `i` is shadowed. But, what is the purpose of this outer loop? Can we just delete it (maybe in a follow-up)?
I think the explanation is here:
https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/Instrumentation/GCOVProfiling.cpp#L545
But you're right: the previous implementation was buggy since i and e were shadowed.
Repository:
rL LLVM
https://reviews.llvm.org/D51619
More information about the llvm-commits
mailing list