Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / Instrumentation / MemorySanitizer / instrumentation-with-call-threshold.ll
blobd7156540e003fe2ff11f175a672379dbf1942e19
1 ; Test -msan-instrumentation-with-call-threshold
2 ; Test that in with-calls mode there are no calls to __msan_chain_origin - they
3 ; are done from __msan_maybe_store_origin_*.
5 ; RUN: opt < %s -msan-check-access-address=0                                   \
6 ; RUN: -msan-instrumentation-with-call-threshold=0 -S -passes=msan 2>&1 |      \
7 ; RUN: FileCheck %s
8 ; RUN: opt < %s -msan-check-access-address=0                                   \
9 ; RUN: -msan-instrumentation-with-call-threshold=0 -msan-track-origins=1 -S    \
10 ; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK                       \
11 ; RUN: -check-prefix=CHECK-ORIGINS %s
12 ; RUN: opt < %s -msan-check-access-address=0                                   \
13 ; RUN: -msan-instrumentation-with-call-threshold=0 -msan-track-origins=2 -S    \
14 ; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK                       \
15 ; RUN: -check-prefix=CHECK-ORIGINS %s
17 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"
18 target triple = "x86_64-unknown-linux-gnu"
20 define void @LoadAndCmp(ptr nocapture %a) nounwind uwtable sanitize_memory {
21 entry:
22   %0 = load i32, ptr %a, align 4
23   %tobool = icmp eq i32 %0, 0
24   br i1 %tobool, label %if.end, label %if.then
26 if.then:                                          ; preds = %entry
27   tail call void (...) @foo() nounwind
28   br label %if.end
30 if.end:                                           ; preds = %entry, %if.then
31   ret void
34 declare void @foo(...)
36 ; CHECK-LABEL: @LoadAndCmp
37 ; CHECK: = load
38 ; CHECK: = load
39 ; CHECK: = zext i1 {{.*}} to i8
40 ; CHECK: call void @__msan_maybe_warning_1(i8 zeroext {{.*}}, i32 zeroext {{.*}})
41 ; CHECK-NOT: unreachable
42 ; CHECK: ret void
45 define void @Store(ptr nocapture %p, i64 %x) nounwind uwtable sanitize_memory {
46 entry:
47   store i64 %x, ptr %p, align 4
48   ret void
51 ; CHECK-LABEL: @Store
52 ; CHECK: load {{.*}} @__msan_param_tls
53 ; CHECK-ORIGINS: load {{.*}} @__msan_param_origin_tls
54 ; CHECK: store
55 ; CHECK-ORIGINS-NOT: __msan_chain_origin
56 ; CHECK-ORIGINS: call void @__msan_maybe_store_origin_8(i64 zeroext {{.*}}, ptr {{.*}}, i32 zeroext {{.*}})
57 ; CHECK-ORIGINS-NOT: __msan_chain_origin
58 ; CHECK: store i64
59 ; CHECK: ret void