[PATCH] D52088: [GCOV] Don't add a useless block in the entry

Marco Castelluccio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 20 02:42:54 PDT 2018


marco-c added inline comments.


================
Comment at: lib/Transforms/Instrumentation/GCOVProfiling.cpp:558
         GCOVBlock &Block = Func.getBlock(&BB);
-        TerminatorInst *TI = BB.getTerminator();
-        if (int successors = TI->getNumSuccessors()) {
-          for (int i = 0; i != successors; ++i) {
-            Block.addEdge(Func.getBlock(TI->getSuccessor(i)));
-          }
-        } else if (isa<ReturnInst>(TI)) {
+        if (succ_begin(&BB) == succ_end(&BB)) {
+          // No successors.
----------------
Nit: I'd keep this the other way around, to have a smaller diff


Repository:
  rL LLVM

https://reviews.llvm.org/D52088





More information about the llvm-commits mailing list