• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Verify that calls with !nosanitize are not instrumented by MSan.
2; RUN: opt < %s -msan -S | FileCheck %s
3; RUN: opt < %s -msan -msan-track-origins=1 -S | FileCheck %s
4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5target triple = "x86_64-unknown-linux-gnu"
6
7declare void @bar(i32 %x)
8
9define void @foo() {
10  call void @bar(i32 7), !nosanitize !{}
11  ret void
12}
13
14; CHECK-LABEL: define void @foo
15; CHECK-NOT: store {{.*}} @__msan_param_tls
16; CHECK: call void @bar
17; CHECK: ret void
18
19
20@__sancov_gen_ = private global [1 x i8] zeroinitializer, section "__sancov_cntrs", align 1
21define void @sancov() sanitize_memory {
22entry:
23  %0 = load i8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @__sancov_gen_, i64 0, i64 0), !nosanitize !{}
24  %1 = add i8 %0, 1
25  store i8 %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @__sancov_gen_, i64 0, i64 0), !nosanitize !{}
26  ret void
27}
28
29; CHECK-LABEL: define void @sancov
30; CHECK-NOT: xor
31; CHECK-NOT: 87960930222080
32; CHECK: ret void
33
34
35define void @load_store() sanitize_memory {
36entry:
37  %x = alloca i32, align 4, !nosanitize !{}
38  store i32 4, i32* %x, align 4, !nosanitize !{}
39  %0 = load i32, i32* %x, align 4, !nosanitize !{}
40  %add = add nsw i32 %0, %0
41  store i32 %add, i32* %x, align 4, !nosanitize !{}
42  ret void
43}
44
45; CHECK-LABEL: define void @load_store
46; CHECK-NOT: xor
47; CHECK-NOT: 87960930222080
48; CHECK: ret void
49