[PATCH] D57982: [SanitizierCoverage] Avoid splitting critical edges when destination is a basic block containing unreachable

Kostya Serebryany via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 27 13:16:51 PST 2019


kcc added a comment.

Reid has a good point, and it equally applies to the current code, which doesn't instrument unreachable blocks.

E.g. here:

  int foo(int *a) {
    if (a)
      return 666;
    throw 42;
  }

if the throw happens we don't get any coverage signal from it because the throw block is not instrumented. 
This might mean a minor loss of signal for coverage, or a major loss of signal for other users of SanitizerCoverage.

Here we will get the coverage today, but IIUC not with this patch:

  int foo(int *a) {
    if (a)
      *a = 666;
    throw 42;
  }

Today, we split a critical edge that leads to throw, and instrument the new BB.

So, apparently, checking for isa<UnreachableInst>(DestBB->getTerminator()) is not the right way to check if the block entry is unreachable.

Thoughts?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57982/new/

https://reviews.llvm.org/D57982





More information about the llvm-commits mailing list