Page MenuHomePhabricator

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

Authored by arphaman on Sep 27 2016, 12:57 PM.



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:

Diff Detail


Event Timeline

arphaman updated this revision to Diff 72692.Sep 27 2016, 12:57 PM
arphaman retitled this revision from to [Coverage] The coverage region for a switch should cover the code after the switch.
arphaman updated this object.
arphaman added a reviewer: vsk.
arphaman set the repository for this revision to rL LLVM.
arphaman added a subscriber: cfe-commits.
vsk accepted this revision.Sep 27 2016, 1:27 PM
vsk edited edge metadata.

LGTM, thank you!

It makes sense to inherit the current region's counter when we see a new switch. That should fix the 0 execution count we see on the condition.

This revision is now accepted and ready to land.Sep 27 2016, 1:27 PM
This revision was automatically updated to reflect the committed changes.