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