[llvm] r265168 - [sancov] save entry block from pruning (it is always full dominator)
Mike Aizatsky via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 1 11:13:20 PDT 2016
Author: aizatsky
Date: Fri Apr 1 13:13:19 2016
New Revision: 265168
URL: http://llvm.org/viewvc/llvm-project?rev=265168&view=rev
Log:
[sancov] save entry block from pruning (it is always full dominator)
Modified:
llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage.ll
Modified: llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp?rev=265168&r1=265167&r2=265168&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp Fri Apr 1 13:13:19 2016
@@ -342,9 +342,9 @@ static bool isFullPostDominator(const Ba
return true;
}
-static bool shouldInstrumentBlock(const BasicBlock *BB, const DominatorTree *DT,
+static bool shouldInstrumentBlock(const Function& F, const BasicBlock *BB, const DominatorTree *DT,
const PostDominatorTree *PDT) {
- if (!ClPruneBlocks)
+ if (!ClPruneBlocks || &F.getEntryBlock() == BB)
return true;
return !(isFullDominator(BB, DT) || isFullPostDominator(BB, PDT));
@@ -374,7 +374,7 @@ bool SanitizerCoverageModule::runOnFunct
&getAnalysis<PostDominatorTreeWrapperPass>(F).getPostDomTree();
for (auto &BB : F) {
- if (shouldInstrumentBlock(&BB, DT, PDT))
+ if (shouldInstrumentBlock(F, &BB, DT, PDT))
BlocksToInstrument.push_back(&BB);
for (auto &Inst : BB) {
if (Options.IndirectCalls) {
Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage.ll?rev=265168&r1=265167&r2=265168&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage.ll (original)
+++ llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage.ll Fri Apr 1 13:13:19 2016
@@ -13,7 +13,7 @@
; RUN: -S | FileCheck %s --check-prefix=CHECK2
; RUN: opt < %s -sancov -sanitizer-coverage-level=2 -sanitizer-coverage-block-threshold=1 \
; RUN: -S | FileCheck %s --check-prefix=CHECK_WITH_CHECK
-; RUN: opt < %s -sancov -sanitizer-coverage-level=2 -sanitizer-coverage-prune-blocks=1 -S | FileCheck %s --check-prefix=CHECKPRUNE
+; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-prune-blocks=1 -S | FileCheck %s --check-prefix=CHECKPRUNE
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-unknown-linux-gnu"
@@ -138,8 +138,7 @@ entry:
; CHECKPRUNE-LABEL: define void @foo
; CHECKPRUNE: call void @__sanitizer_cov
-; CHECKPRUNE: call void asm sideeffect "", ""()
; CHECKPRUNE: call void @__sanitizer_cov
-; CHECKPRUNE: call void asm sideeffect "", ""()
+; CHECKPRUNE: call void @__sanitizer_cov
; CHECKPRUNE-NOT: call void @__sanitizer_cov
; CHECKPRUNE: ret void
More information about the llvm-commits
mailing list