Home | History | Annotate | Download | only in MemorySanitizer
      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_*.
      4 
      5 ; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -S | FileCheck %s
      6 ; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
      7 ; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -msan-track-origins=2 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
      8 
      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"
     11 
     12 define void @LoadAndCmp(i32* nocapture %a) nounwind uwtable sanitize_memory {
     13 entry:
     14   %0 = load i32, i32* %a, align 4
     15   %tobool = icmp eq i32 %0, 0
     16   br i1 %tobool, label %if.end, label %if.then
     17 
     18 if.then:                                          ; preds = %entry
     19   tail call void (...) @foo() nounwind
     20   br label %if.end
     21 
     22 if.end:                                           ; preds = %entry, %if.then
     23   ret void
     24 }
     25 
     26 declare void @foo(...)
     27 
     28 ; CHECK-LABEL: @LoadAndCmp
     29 ; CHECK: = load
     30 ; CHECK: = load
     31 ; CHECK: = zext i1 {{.*}} to i8
     32 ; CHECK: call void @__msan_maybe_warning_1(
     33 ; CHECK-NOT: unreachable
     34 ; CHECK: ret void
     35 
     36 
     37 define void @Store(i64* nocapture %p, i64 %x) nounwind uwtable sanitize_memory {
     38 entry:
     39   store i64 %x, i64* %p, align 4
     40   ret void
     41 }
     42 
     43 ; CHECK-LABEL: @Store
     44 ; CHECK: load {{.*}} @__msan_param_tls
     45 ; CHECK-ORIGINS: load {{.*}} @__msan_param_origin_tls
     46 ; CHECK: store
     47 ; CHECK-ORIGINS-NOT: __msan_chain_origin
     48 ; CHECK-ORIGINS: bitcast i64* {{.*}} to i8*
     49 ; CHECK-ORIGINS-NOT: __msan_chain_origin
     50 ; CHECK-ORIGINS: call void @__msan_maybe_store_origin_8(
     51 ; CHECK-ORIGINS-NOT: __msan_chain_origin
     52 ; CHECK: store i64
     53 ; CHECK: ret void
     54