1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/test/Instrumentation/MemorySanitizer/instrumentation-with-call-threshold.ll
Philip Pfaffe 65df098609 [NewPM] Port Msan
Summary:
Keeping msan a function pass requires replacing the module level initialization:
That means, don't define a ctor function which calls __msan_init, instead just
declare the init function at the first access, and add that to the global ctors
list.

Changes:
- Pull the actual sanitizer and the wrapper pass apart.
- Add a newpm msan pass. The function pass inserts calls to runtime
  library functions, for which it inserts declarations as necessary.
- Update tests.

Caveats:
- There is one test that I dropped, because it specifically tested the
  definition of the ctor.

Reviewers: chandlerc, fedor.sergeev, leonardchan, vitalybuka

Subscribers: sdardis, nemanjai, javed.absar, hiraditya, kbarton, bollu, atanasyan, jsji

Differential Revision: https://reviews.llvm.org/D55647

llvm-svn: 350305
2019-01-03 13:42:44 +00:00

65 lines
2.7 KiB
LLVM

; Test -msan-instrumentation-with-call-threshold
; Test that in with-calls mode there are no calls to __msan_chain_origin - they
; are done from __msan_maybe_store_origin_*.
; RUN: opt < %s -msan-check-access-address=0 \
; RUN: -msan-instrumentation-with-call-threshold=0 -S -passes=msan 2>&1 | \
; RUN: FileCheck %s
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -S | FileCheck %s
; RUN: opt < %s -msan-check-access-address=0 \
; RUN: -msan-instrumentation-with-call-threshold=0 -msan-track-origins=1 -S \
; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK \
; RUN: -check-prefix=CHECK-ORIGINS %s
; 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
; RUN: opt < %s -msan-check-access-address=0 \
; RUN: -msan-instrumentation-with-call-threshold=0 -msan-track-origins=2 -S \
; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK \
; RUN: -check-prefix=CHECK-ORIGINS %s
; 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
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"
target triple = "x86_64-unknown-linux-gnu"
define void @LoadAndCmp(i32* nocapture %a) nounwind uwtable sanitize_memory {
entry:
%0 = load i32, i32* %a, align 4
%tobool = icmp eq i32 %0, 0
br i1 %tobool, label %if.end, label %if.then
if.then: ; preds = %entry
tail call void (...) @foo() nounwind
br label %if.end
if.end: ; preds = %entry, %if.then
ret void
}
declare void @foo(...)
; CHECK-LABEL: @LoadAndCmp
; CHECK: = load
; CHECK: = load
; CHECK: = zext i1 {{.*}} to i8
; CHECK: call void @__msan_maybe_warning_1(
; CHECK-NOT: unreachable
; CHECK: ret void
define void @Store(i64* nocapture %p, i64 %x) nounwind uwtable sanitize_memory {
entry:
store i64 %x, i64* %p, align 4
ret void
}
; CHECK-LABEL: @Store
; CHECK: load {{.*}} @__msan_param_tls
; CHECK-ORIGINS: load {{.*}} @__msan_param_origin_tls
; CHECK: store
; CHECK-ORIGINS-NOT: __msan_chain_origin
; CHECK-ORIGINS: bitcast i64* {{.*}} to i8*
; CHECK-ORIGINS-NOT: __msan_chain_origin
; CHECK-ORIGINS: call void @__msan_maybe_store_origin_8(
; CHECK-ORIGINS-NOT: __msan_chain_origin
; CHECK: store i64
; CHECK: ret void