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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 8 16:04:15 PST 2019


craig.topper added a comment.

In D57982#1391319 <https://reviews.llvm.org/D57982#1391319>, @efriedma wrote:

> > But since this block itself shouldn't be reachable this is pointless.
>
> Your testcase shows an empty unreachable block, but it's also possible to have a block that ends with an unreachable, but still has reachable code, like a call to exit().


Should this code from SanitizerCoverage.cpp be checking that the first non-debug instruction is an unreachable instead of the terminator?

  static bool shouldInstrumentBlock(const Function &F, const BasicBlock *BB,
                                    const DominatorTree *DT,
                                    const PostDominatorTree *PDT,
                                    const SanitizerCoverageOptions &Options) {
    // Don't insert coverage for unreachable blocks: we will never call
    // __sanitizer_cov() for them, so counting them in
    // NumberOfInstrumentedBlocks() might complicate calculation of code coverage
    // percentage. Also, unreachable instructions frequently have no debug
    // locations.
    if (isa<UnreachableInst>(BB->getTerminator()))
      return false;


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

https://reviews.llvm.org/D57982





More information about the llvm-commits mailing list