1 ; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck %s --implicit-check-not="call void @__msan_warning"
2 ; RUN: opt < %s -msan-check-access-address=1 -S -passes=msan 2>&1 | FileCheck %s --check-prefix=ADDR --implicit-check-not="call void @__msan_warning"
4 ; REQUIRES: x86-registered-target
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"
9 declare void @llvm.x86.sse.stmxcsr(ptr)
10 declare void @llvm.x86.sse.ldmxcsr(ptr)
12 define void @getcsr(ptr %p) sanitize_memory {
14 call void @llvm.x86.sse.stmxcsr(ptr %p)
18 ; CHECK-LABEL: @getcsr(
19 ; CHECK: store i32 0, ptr
20 ; CHECK: call void @llvm.x86.sse.stmxcsr(
23 ; ADDR-LABEL: @getcsr(
24 ; ADDR: %[[A:.*]] = load i64, ptr @__msan_param_tls, align 8
25 ; ADDR: %[[B:.*]] = icmp ne i64 %[[A]], 0
26 ; ADDR: br i1 %[[B]], label {{.*}}, label
27 ; ADDR: call void @__msan_warning_noreturn()
28 ; ADDR: call void @llvm.x86.sse.stmxcsr(
31 ; Function Attrs: nounwind uwtable
32 define void @setcsr(ptr %p) sanitize_memory {
34 call void @llvm.x86.sse.ldmxcsr(ptr %p)
38 ; CHECK-LABEL: @setcsr(
39 ; CHECK: %[[A:.*]] = load i32, ptr %{{.*}}, align 1
40 ; CHECK: %[[B:.*]] = icmp ne i32 %[[A]], 0
41 ; CHECK: br i1 %[[B]], label {{.*}}, label
42 ; CHECK: call void @__msan_warning_noreturn()
43 ; CHECK: call void @llvm.x86.sse.ldmxcsr(
46 ; ADDR-LABEL: @setcsr(
47 ; ADDR: %[[A:.*]] = load i64, ptr @__msan_param_tls, align 8
48 ; ADDR: %[[C:.*]] = load i32, ptr
49 ; ADDR: %[[B:.*]] = icmp ne i64 %[[A]], 0
50 ; ADDR: %[[D:.*]] = icmp ne i32 %[[C]], 0
51 ; ADDR: %[[E:.*]] = or i1 %[[B]], %[[D]]
52 ; ADDR: br i1 %[[E]], label {{.*}}, label
53 ; ADDR: call void @__msan_warning_noreturn()
54 ; ADDR: call void @llvm.x86.sse.ldmxcsr(