| Stephen Hines | 36b5688 | 2014-04-23 16:57:46 -0700 | [diff] [blame] | 1 | ; RUN: opt < %s -asan -asan-module -asan-coverage=1 -S | FileCheck %s --check-prefix=CHECK1 |
| 2 | ; RUN: opt < %s -asan -asan-module -asan-coverage=2 -S | FileCheck %s --check-prefix=CHECK2 |
| Stephen Hines | dce4a40 | 2014-05-29 02:49:00 -0700 | [diff] [blame^] | 3 | ; RUN: opt < %s -asan -asan-module -asan-coverage=2 -asan-coverage-block-threshold=10 -S | FileCheck %s --check-prefix=CHECK2 |
| 4 | ; RUN: opt < %s -asan -asan-module -asan-coverage=2 -asan-coverage-block-threshold=1 -S | FileCheck %s --check-prefix=CHECK1 |
| Bob Wilson | 4b89914 | 2013-11-15 07:16:09 +0000 | [diff] [blame] | 5 | 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" |
| 6 | target triple = "x86_64-unknown-linux-gnu" |
| Stephen Hines | 36b5688 | 2014-04-23 16:57:46 -0700 | [diff] [blame] | 7 | define void @foo(i32* %a) sanitize_address { |
| Bob Wilson | 4b89914 | 2013-11-15 07:16:09 +0000 | [diff] [blame] | 8 | entry: |
| Stephen Hines | 36b5688 | 2014-04-23 16:57:46 -0700 | [diff] [blame] | 9 | %tobool = icmp eq i32* %a, null |
| 10 | br i1 %tobool, label %if.end, label %if.then |
| 11 | |
| 12 | if.then: ; preds = %entry |
| 13 | store i32 0, i32* %a, align 4 |
| 14 | br label %if.end |
| 15 | |
| 16 | if.end: ; preds = %entry, %if.then |
| 17 | ret void |
| Bob Wilson | 4b89914 | 2013-11-15 07:16:09 +0000 | [diff] [blame] | 18 | } |
| Stephen Hines | dce4a40 | 2014-05-29 02:49:00 -0700 | [diff] [blame^] | 19 | |
| Stephen Hines | 36b5688 | 2014-04-23 16:57:46 -0700 | [diff] [blame] | 20 | ; CHECK1-LABEL: define void @foo |
| 21 | ; CHECK1: %0 = load atomic i8* @__asan_gen_cov_foo monotonic, align 1 |
| 22 | ; CHECK1: %1 = icmp eq i8 0, %0 |
| 23 | ; CHECK1: br i1 %1, label %2, label %3 |
| 24 | ; CHECK1: call void @__sanitizer_cov |
| 25 | ; CHECK1-NOT: call void @__sanitizer_cov |
| 26 | ; CHECK1: store atomic i8 1, i8* @__asan_gen_cov_foo monotonic, align 1 |
| 27 | |
| Stephen Hines | dce4a40 | 2014-05-29 02:49:00 -0700 | [diff] [blame^] | 28 | ; CHECK1-LABEL: define internal void @asan.module_ctor |
| 29 | ; CHECK1-NOT: ret |
| 30 | ; CHECK1: call void @__sanitizer_cov_module_init(i64 1) |
| 31 | ; CHECK1: ret |
| 32 | |
| 33 | |
| Stephen Hines | 36b5688 | 2014-04-23 16:57:46 -0700 | [diff] [blame] | 34 | ; CHECK2-LABEL: define void @foo |
| 35 | ; CHECK2: call void @__sanitizer_cov |
| 36 | ; CHECK2: call void @__sanitizer_cov |
| 37 | ; CHECK2: call void @__sanitizer_cov |
| 38 | ; CHECK2-NOT: call void @__sanitizer_cov |
| 39 | ; CHECK2: ret void |
| Stephen Hines | dce4a40 | 2014-05-29 02:49:00 -0700 | [diff] [blame^] | 40 | |
| 41 | ; CHECK2-LABEL: define internal void @asan.module_ctor |
| 42 | ; CHECK2-NOT: ret |
| 43 | ; CHECK2: call void @__sanitizer_cov_module_init(i64 3) |
| 44 | ; CHECK2: ret |