mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-13 23:18:51 +00:00
[asan] one more workaround for PR17409: don't do BB-level coverage instrumentation if there are more than N (=1500) basic blocks. This makes ASanCoverage work on libjpeg_turbo/jchuff.c used by Chrome, which has 1824 BBs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206564 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a1da819896
commit
40a9c0f58b
@ -135,6 +135,10 @@ static cl::opt<bool> ClGlobals("asan-globals",
|
||||
static cl::opt<int> ClCoverage("asan-coverage",
|
||||
cl::desc("ASan coverage. 0: none, 1: entry block, 2: all blocks"),
|
||||
cl::Hidden, cl::init(false));
|
||||
static cl::opt<int> ClCoverageBlockThreshold("asan-coverage-block-threshold",
|
||||
cl::desc("Add coverage instrumentation only to the entry block if there "
|
||||
"are more than this number of blocks."),
|
||||
cl::Hidden, cl::init(1500));
|
||||
static cl::opt<bool> ClInitializers("asan-initialization-order",
|
||||
cl::desc("Handle C++ initializer order"), cl::Hidden, cl::init(false));
|
||||
static cl::opt<bool> ClMemIntrin("asan-memintrin",
|
||||
@ -1263,7 +1267,8 @@ bool AddressSanitizer::InjectCoverage(Function &F,
|
||||
const ArrayRef<BasicBlock *> AllBlocks) {
|
||||
if (!ClCoverage) return false;
|
||||
|
||||
if (ClCoverage == 1) {
|
||||
if (ClCoverage == 1 ||
|
||||
(unsigned)ClCoverageBlockThreshold < AllBlocks.size()) {
|
||||
InjectCoverageAtBlock(F, F.getEntryBlock());
|
||||
} else {
|
||||
for (size_t i = 0, n = AllBlocks.size(); i < n; i++)
|
||||
|
@ -1,5 +1,7 @@
|
||||
; RUN: opt < %s -asan -asan-module -asan-coverage=1 -S | FileCheck %s --check-prefix=CHECK1
|
||||
; RUN: opt < %s -asan -asan-module -asan-coverage=2 -S | FileCheck %s --check-prefix=CHECK2
|
||||
; RUN: opt < %s -asan -asan-module -asan-coverage=2 -asan-coverage-block-threshold=10 -S | FileCheck %s --check-prefix=CHECK2
|
||||
; RUN: opt < %s -asan -asan-module -asan-coverage=2 -asan-coverage-block-threshold=1 -S | FileCheck %s --check-prefix=CHECK1
|
||||
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"
|
||||
define void @foo(i32* %a) sanitize_address {
|
||||
|
Loading…
Reference in New Issue
Block a user