Home | History | Annotate | Download | only in AddressSanitizer
      1 ; RUN: opt < %s -asan -asan-module -asan-coverage=0 -S | FileCheck %s --check-prefix=CHECK0
      2 ; RUN: opt < %s -asan -asan-module -asan-coverage=1 -S | FileCheck %s --check-prefix=CHECK1
      3 ; RUN: opt < %s -asan -asan-module -asan-coverage=2 -S | FileCheck %s --check-prefix=CHECK2
      4 ; RUN: opt < %s -asan -asan-module -asan-coverage=2 -asan-coverage-block-threshold=10 -S | FileCheck %s --check-prefix=CHECK2
      5 ; RUN: opt < %s -asan -asan-module -asan-coverage=2 -asan-coverage-block-threshold=1  -S | FileCheck %s --check-prefix=CHECK1
      6 
      7 ; RUN: opt < %s -asan -asan-module -asan-coverage=0 -asan-globals=0 -S | \
      8 ; RUN:     FileCheck %s --check-prefix=CHECK0
      9 ; RUN: opt < %s -asan -asan-module -asan-coverage=1 -asan-globals=0 -S | \
     10 ; RUN:     FileCheck %s --check-prefix=CHECK1
     11 ; RUN: opt < %s -asan -asan-module -asan-coverage=2 -asan-globals=0 -S | \
     12 ; RUN:     FileCheck %s --check-prefix=CHECK2
     13 ; RUN: opt < %s -asan -asan-module -asan-coverage=2 -asan-coverage-block-threshold=10 \
     14 ; RUN:     -asan-globals=0 -S | FileCheck %s --check-prefix=CHECK2
     15 ; RUN: opt < %s -asan -asan-module -asan-coverage=2 -asan-coverage-block-threshold=1 \
     16 ; RUN:     -asan-globals=0 -S | FileCheck %s --check-prefix=CHECK1
     17 
     18 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"
     19 target triple = "x86_64-unknown-linux-gnu"
     20 define void @foo(i32* %a) sanitize_address {
     21 entry:
     22   %tobool = icmp eq i32* %a, null
     23   br i1 %tobool, label %if.end, label %if.then
     24 
     25   if.then:                                          ; preds = %entry
     26   store i32 0, i32* %a, align 4
     27   br label %if.end
     28 
     29   if.end:                                           ; preds = %entry, %if.then
     30   ret void
     31 }
     32 
     33 ; CHECK0-NOT: call void @__sanitizer_cov(
     34 ; CHECK0-NOT: call void @__sanitizer_cov_module_init(
     35 
     36 ; CHECK1-LABEL: define void @foo
     37 ; CHECK1: %0 = load atomic i8* @__asan_gen_cov_foo monotonic, align 1
     38 ; CHECK1: %1 = icmp eq i8 0, %0
     39 ; CHECK1: br i1 %1, label %2, label %3
     40 ; CHECK1: call void @__sanitizer_cov
     41 ; CHECK1-NOT: call void @__sanitizer_cov
     42 ; CHECK1: store atomic i8 1, i8* @__asan_gen_cov_foo monotonic, align 1
     43 
     44 ; CHECK1-LABEL: define internal void @asan.module_ctor
     45 ; CHECK1-NOT: ret
     46 ; CHECK1: call void @__sanitizer_cov_module_init(i64 1)
     47 ; CHECK1: ret
     48 
     49 
     50 ; CHECK2-LABEL: define void @foo
     51 ; CHECK2: call void @__sanitizer_cov
     52 ; CHECK2: call void @__sanitizer_cov
     53 ; CHECK2: call void @__sanitizer_cov
     54 ; CHECK2-NOT: call void @__sanitizer_cov
     55 ; CHECK2: ret void
     56 
     57 ; CHECK2-LABEL: define internal void @asan.module_ctor
     58 ; CHECK2-NOT: ret
     59 ; CHECK2: call void @__sanitizer_cov_module_init(i64 3)
     60 ; CHECK2: ret
     61