diff options
| author | Alexey Samsonov <vonosmas@gmail.com> | 2015-06-30 23:11:45 +0000 |
|---|---|---|
| committer | Alexey Samsonov <vonosmas@gmail.com> | 2015-06-30 23:11:45 +0000 |
| commit | 342b1e8053ef493d174aa9227df8a82ed022ee68 (patch) | |
| tree | c139a27c79edf0d4a9a60325acbd0ed24e1159c7 /llvm/lib | |
| parent | 3e32a4e717c054275dd2062fc3b2551ac56e0c49 (diff) | |
| download | bcm5719-llvm-342b1e8053ef493d174aa9227df8a82ed022ee68.tar.gz bcm5719-llvm-342b1e8053ef493d174aa9227df8a82ed022ee68.zip | |
[SanitizerCoverage] Don't add instrumentation to unreachable blocks.
llvm-svn: 241127
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp index dff39efa5b9..7a5b4cb0178 100644 --- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp +++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp @@ -375,6 +375,13 @@ void SanitizerCoverageModule::SetNoSanitizeMetadata(Instruction *I) { void SanitizerCoverageModule::InjectCoverageAtBlock(Function &F, BasicBlock &BB, bool UseCalls) { + // 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; BasicBlock::iterator IP = BB.getFirstInsertionPt(), BE = BB.end(); // Skip static allocas at the top of the entry block so they don't become // dynamic when we split the block. If we used our optimized stack layout, |

