2017-05-11 19:07:48 +08:00
|
|
|
; Regression test for https://bugs.llvm.org/show_bug.cgi?id=32842
|
|
|
|
;
|
[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 21:42:44 +08:00
|
|
|
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
|
2017-05-11 19:07:48 +08:00
|
|
|
; RUN: opt < %s -msan -S | FileCheck %s
|
|
|
|
;target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
|
|
|
|
define zeroext i1 @_Z1fii(i32 %x, i32 %y) sanitize_memory {
|
|
|
|
entry:
|
|
|
|
%cmp = icmp slt i32 %x, %y
|
|
|
|
ret i1 %cmp
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: [[X:[^ ]+]] = load{{.*}}__msan_param_tls{{.*}}
|
|
|
|
; CHECK: [[Y:[^ ]+]] = load{{.*}}__msan_param_tls{{.*}}
|
|
|
|
; CHECK: [[OR:[^ ]+]] = or i32 [[Y]], [[X]]
|
|
|
|
|
|
|
|
; Make sure the shadow of the (x < y) comparison isn't truncated to i1.
|
|
|
|
; CHECK-NOT: trunc i32 [[OR]] to i1
|
|
|
|
; CHECK: [[CMP:[^ ]+]] = icmp ne i32 [[OR]], 0
|
|
|
|
; CHECK: store i1 [[CMP]],{{.*}}__msan_retval_tls
|