1 ; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
3 ; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
4 ; RUN: opt < %s -msan-check-access-address=1 -S -passes=msan 2>&1 | FileCheck \
5 ; RUN: %s --check-prefix=ADDR
6 ; RUN: opt < %s -msan -msan-check-access-address=1 -S | FileCheck %s --check-prefix=ADDR
7 ; REQUIRES: x86-registered-target
9 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"
10 target triple = "x86_64-unknown-linux-gnu"
12 declare void @llvm.x86.sse.stmxcsr(i8*)
13 declare void @llvm.x86.sse.ldmxcsr(i8*)
15 define void @getcsr(i32 *%p) sanitize_memory {
17 %0 = bitcast i32* %p to i8*
18 call void @llvm.x86.sse.stmxcsr(i8* %0)
22 ; CHECK-LABEL: @getcsr(
23 ; CHECK: store i32 0, i32*
24 ; CHECK: call void @llvm.x86.sse.stmxcsr(
27 ; ADDR-LABEL: @getcsr(
28 ; ADDR: %[[A:.*]] = load i64, i64* getelementptr inbounds {{.*}} @__msan_param_tls, i32 0, i32 0), align 8
29 ; ADDR: %[[B:.*]] = icmp ne i64 %[[A]], 0
30 ; ADDR: br i1 %[[B]], label {{.*}}, label
31 ; ADDR: call void @__msan_warning_noreturn()
32 ; ADDR: call void @llvm.x86.sse.stmxcsr(
35 ; Function Attrs: nounwind uwtable
36 define void @setcsr(i32 *%p) sanitize_memory {
38 %0 = bitcast i32* %p to i8*
39 call void @llvm.x86.sse.ldmxcsr(i8* %0)
43 ; CHECK-LABEL: @setcsr(
44 ; CHECK: %[[A:.*]] = load i32, i32* %{{.*}}, align 1
45 ; CHECK: %[[B:.*]] = icmp ne i32 %[[A]], 0
46 ; CHECK: br i1 %[[B]], label {{.*}}, label
47 ; CHECK: call void @__msan_warning_noreturn()
48 ; CHECK: call void @llvm.x86.sse.ldmxcsr(
51 ; ADDR-LABEL: @setcsr(
52 ; ADDR: %[[A:.*]] = load i64, i64* getelementptr inbounds {{.*}} @__msan_param_tls, i32 0, i32 0), align 8
53 ; ADDR: %[[B:.*]] = icmp ne i64 %[[A]], 0
54 ; ADDR: br i1 %[[B]], label {{.*}}, label
55 ; ADDR: call void @__msan_warning_noreturn()
56 ; ADDR: call void @llvm.x86.sse.ldmxcsr(