[PATCH] D24981: [Coverage] The coverage region for a switch should cover the code after the switch

Alex Lorenz via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 27 12:58:00 PDT 2016


arphaman created this revision.
arphaman added a reviewer: vsk.
arphaman added a subscriber: cfe-commits.
arphaman set the repository for this revision to rL LLVM.

This patch fixes a regression introduced in r262697 that changed the way the coverage regions for switch are constructed. The PGO instrumentation counter for switch statements refers to a counter at the exit of the switch, and thus the coverage region for the switch statement should cover the code that comes after the switch, and not the switch statement itself.

This patch should fix the issue exposed by the new coverage bot where the switches with all cases returning get zero coverage:  http://lab.llvm.org:8080/coverage/coverage-reports/clang/coverage/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp.html#L520.

Repository:
  rL LLVM

https://reviews.llvm.org/D24981

Files:
  lib/CodeGen/CoverageMappingGen.cpp
  test/CoverageMapping/switch.c
  test/CoverageMapping/switchmacro.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24981.72692.patch
Type: text/x-patch
Size: 4796 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160927/fa9e1aea/attachment.bin>


More information about the cfe-commits mailing list