1; Test -sanitizer-coverage-experimental-tracing 2; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc -S | FileCheck %s --check-prefix=CHECK_PC 3; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s --check-prefix=CHECK_PC_GUARD 4; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -S -mtriple=x86_64-apple-macosx | FileCheck %s --check-prefix=CHECK_PC_GUARD_DARWIN 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 21define available_externally void @external_bar(i32* %a) sanitize_address { 22entry: 23 ret void 24} 25 26 27; CHECK_PC-LABEL: define void @foo 28; CHECK_PC: call void @__sanitizer_cov_trace_pc 29; CHECK_PC: call void @__sanitizer_cov_trace_pc 30; CHECK_PC: call void @__sanitizer_cov_trace_pc 31; CHECK_PC-NOT: call void @__sanitizer_cov_trace_pc 32; CHECK_PC: ret void 33; CHECK_PC-NOT: call void @__sanitizer_cov_module_init 34 35; CHECK_PC_GUARD: section "__sancov_guards", align 4 36; CHECK_PC_GUARD-LABEL: define void @foo 37; CHECK_PC_GUARD: call void @__sanitizer_cov_trace_pc_guard 38; CHECK_PC_GUARD: call void @__sanitizer_cov_trace_pc_guard 39; CHECK_PC_GUARD: call void @__sanitizer_cov_trace_pc_guard 40; CHECK_PC_GUARD-NOT: call void @__sanitizer_cov_trace_pc 41; CHECK_PC_GUARD: ret void 42; CHECK_PC_GUARD-LABEL: @external_bar 43; CHECK_PC_GUARD-NOT: call void @__sanitizer_cov_trace_pc 44; CHECK_PC_GUARD: ret void 45 46; CHECK_PC_GUARD: call void @__sanitizer_cov_trace_pc_guard_init(i32* bitcast (i32** @__start___sancov_guards to i32*), i32* bitcast (i32** @__stop___sancov_guards to i32*)) 47 48; CHECK_PC_GUARD_DARWIN-LABEL: define void @foo 49; CHECK_PC_GUARD_DARWIN: call void @__sanitizer_cov_trace_pc_guard 50; CHECK_PC_GUARD_DARWIN: call void @__sanitizer_cov_trace_pc_guard 51; CHECK_PC_GUARD_DARWIN: call void @__sanitizer_cov_trace_pc_guard 52; CHECK_PC_GUARD_DARWIN-NOT: call void @__sanitizer_cov_trace_pc 53; CHECK_PC_GUARD_DARWIN: ret void 54; CHECK_PC_GUARD_DARWIN: call void @__sanitizer_cov_trace_pc_guard_init(i32* bitcast (i32** @"\01section$start$__DATA$__sancov_guards" to i32*), i32* bitcast (i32** @"\01section$end$__DATA$__sancov_guards" to i32*)) 55