[msan] Add -msan-instrumentation-with-call-threshold.
[oota-llvm.git] / test / Instrumentation / MemorySanitizer / instrumentation-with-call-threshold.ll
1 ; Test -msan-instrumentation-with-call-threshold
2
3 ; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -S | FileCheck %s
4 ; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
5
6 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-S128"
7 target triple = "x86_64-unknown-linux-gnu"
8
9 define void @LoadAndCmp(i32* nocapture %a) nounwind uwtable sanitize_memory {
10 entry:
11   %0 = load i32* %a, align 4
12   %tobool = icmp eq i32 %0, 0
13   br i1 %tobool, label %if.end, label %if.then
14
15 if.then:                                          ; preds = %entry
16   tail call void (...)* @foo() nounwind
17   br label %if.end
18
19 if.end:                                           ; preds = %entry, %if.then
20   ret void
21 }
22
23 declare void @foo(...)
24
25 ; CHECK-LABEL: @LoadAndCmp
26 ; CHECK: = load
27 ; CHECK: = load
28 ; CHECK: = zext i1 {{.*}} to i8
29 ; CHECK: call void @__msan_maybe_warning_1(
30 ; CHECK-NOT: unreachable
31 ; CHECK: ret void
32
33
34 define void @Store(i64* nocapture %p, i64 %x) nounwind uwtable sanitize_memory {
35 entry:
36   store i64 %x, i64* %p, align 4
37   ret void
38 }
39
40 ; CHECK-LABEL: @Store
41 ; CHECK: load {{.*}} @__msan_param_tls
42 ; CHECK-ORIGINS: load {{.*}} @__msan_param_origin_tls
43 ; CHECK: store
44 ; CHECK-ORIGINS: bitcast i64* {{.*}} to i8*
45 ; CHECK-ORIGINS: call void @__msan_maybe_store_origin_8(
46 ; CHECK: store i64
47 ; CHECK: ret void