• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test -sanitizer-coverage-experimental-tracing
2; RUN: opt < %s -sancov -sanitizer-coverage-level=2 -sanitizer-coverage-experimental-tracing  -S | FileCheck %s --check-prefix=CHECK1
3; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-experimental-tracing  -S | FileCheck %s --check-prefix=CHECK3
4; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc  -S | FileCheck %s --check-prefix=CHECK_PC
5
6target 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"
7target triple = "x86_64-unknown-linux-gnu"
8define void @foo(i32* %a) sanitize_address {
9entry:
10  %tobool = icmp eq i32* %a, null
11  br i1 %tobool, label %if.end, label %if.then
12
13  if.then:                                          ; preds = %entry
14  store i32 0, i32* %a, align 4
15  br label %if.end
16
17  if.end:                                           ; preds = %entry, %if.then
18  ret void
19}
20
21; CHECK1-LABEL: define void @foo
22; CHECK1: call void @__sanitizer_cov_trace_func_enter
23; CHECK1: call void @__sanitizer_cov_trace_basic_block
24; CHECK1-NOT: call void @__sanitizer_cov_trace_basic_block
25; CHECK1: ret void
26
27; CHECK3-LABEL: define void @foo
28; CHECK3: call void @__sanitizer_cov_trace_func_enter
29; CHECK3: call void @__sanitizer_cov_trace_basic_block
30; CHECK3: call void @__sanitizer_cov_trace_basic_block
31; CHECK3-NOT: call void @__sanitizer_cov_trace_basic_block
32; CHECK3: ret void
33
34; CHECK_PC-LABEL: define void @foo
35; CHECK_PC: call void @__sanitizer_cov_trace_pc
36; CHECK_PC: call void @__sanitizer_cov_trace_pc
37; CHECK_PC: call void @__sanitizer_cov_trace_pc
38; CHECK_PC-NOT: call void @__sanitizer_cov_trace_pc
39; CHECK_PC: ret void
40; CHECK_PC-NOT: call void @__sanitizer_cov_module_init
41