1 ; RUN: opt < %s -sancov -sanitizer-coverage-level=4 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s --check-prefix=CHECK_TRACE_PC_GUARD
2 ; RUN: opt < %s -passes='module(sancov-module)' -sanitizer-coverage-level=4 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s --check-prefix=CHECK_TRACE_PC_GUARD
4 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"
5 target triple = "x86_64-apple-darwin10.0.0"
6 define void @foo(i32* %a) sanitize_address {
8 %tobool = icmp eq i32* %a, null
9 br i1 %tobool, label %if.end, label %if.then
11 if.then: ; preds = %entry
12 store i32 0, i32* %a, align 4
15 if.end: ; preds = %entry, %if.then
19 %struct.StructWithVptr = type { i32 (...)** }
21 define void @CallViaVptr(%struct.StructWithVptr* %foo) uwtable sanitize_address {
23 %0 = bitcast %struct.StructWithVptr* %foo to void (%struct.StructWithVptr*)***
24 %vtable = load void (%struct.StructWithVptr*)**, void (%struct.StructWithVptr*)*** %0, align 8
25 %1 = load void (%struct.StructWithVptr*)*, void (%struct.StructWithVptr*)** %vtable, align 8
26 tail call void %1(%struct.StructWithVptr* %foo)
27 tail call void %1(%struct.StructWithVptr* %foo)
28 tail call void asm sideeffect "", ""()
32 ; CHECK_TRACE_PC_GUARD-LABEL: define void @foo
33 ; CHECK_TRACE_PC_GUARD: call void @__sanitizer_cov_trace_pc
34 ; CHECK_TRACE_PC_GUARD: call void asm sideeffect "", ""()
35 ; CHECK_TRACE_PC_GUARD: ret void
37 ; CHECK_TRACE_PC_GUARD-LABEL: define void @CallViaVptr
38 ; CHECK_TRACE_PC_GUARD: call void @__sanitizer_cov_trace_pc_indir
39 ; CHECK_TRACE_PC_GUARD: call void @__sanitizer_cov_trace_pc_indir
40 ; CHECK_TRACE_PC_GUARD: ret void
42 ; CHECK_TRACE_PC_GUARD-LABEL: define internal void @sancov.module_ctor_trace_pc_guard() {