mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
65df098609
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
69 lines
2.4 KiB
LLVM
69 lines
2.4 KiB
LLVM
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
|
|
; RUN: %s
|
|
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
|
|
; REQUIRES: x86-registered-target
|
|
|
|
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"
|
|
|
|
declare <4 x i32> @llvm.x86.sse2.pmadd.wd(<8 x i16>, <8 x i16>) nounwind readnone
|
|
declare x86_mmx @llvm.x86.ssse3.pmadd.ub.sw(x86_mmx, x86_mmx) nounwind readnone
|
|
declare <2 x i64> @llvm.x86.sse2.psad.bw(<16 x i8>, <16 x i8>) nounwind readnone
|
|
declare x86_mmx @llvm.x86.mmx.psad.bw(x86_mmx, x86_mmx) nounwind readnone
|
|
|
|
define <4 x i32> @Test_sse2_pmadd_wd(<8 x i16> %a, <8 x i16> %b) sanitize_memory {
|
|
entry:
|
|
%c = tail call <4 x i32> @llvm.x86.sse2.pmadd.wd(<8 x i16> %a, <8 x i16> %b) nounwind
|
|
ret <4 x i32> %c
|
|
}
|
|
|
|
; CHECK-LABEL: @Test_sse2_pmadd_wd(
|
|
; CHECK: or <8 x i16>
|
|
; CHECK: bitcast <8 x i16> {{.*}} to <4 x i32>
|
|
; CHECK: icmp ne <4 x i32> {{.*}}, zeroinitializer
|
|
; CHECK: sext <4 x i1> {{.*}} to <4 x i32>
|
|
; CHECK: ret <4 x i32>
|
|
|
|
|
|
define x86_mmx @Test_ssse3_pmadd_ub_sw(x86_mmx %a, x86_mmx %b) sanitize_memory {
|
|
entry:
|
|
%c = tail call x86_mmx @llvm.x86.ssse3.pmadd.ub.sw(x86_mmx %a, x86_mmx %b) nounwind
|
|
ret x86_mmx %c
|
|
}
|
|
|
|
; CHECK-LABEL: @Test_ssse3_pmadd_ub_sw(
|
|
; CHECK: or i64
|
|
; CHECK: bitcast i64 {{.*}} to <4 x i16>
|
|
; CHECK: icmp ne <4 x i16> {{.*}}, zeroinitializer
|
|
; CHECK: sext <4 x i1> {{.*}} to <4 x i16>
|
|
; CHECK: bitcast <4 x i16> {{.*}} to i64
|
|
; CHECK: ret x86_mmx
|
|
|
|
|
|
define <2 x i64> @Test_x86_sse2_psad_bw(<16 x i8> %a, <16 x i8> %b) sanitize_memory {
|
|
%c = tail call <2 x i64> @llvm.x86.sse2.psad.bw(<16 x i8> %a, <16 x i8> %b)
|
|
ret <2 x i64> %c
|
|
}
|
|
|
|
; CHECK-LABEL: @Test_x86_sse2_psad_bw(
|
|
; CHECK: or <16 x i8> {{.*}}, {{.*}}
|
|
; CHECK: bitcast <16 x i8> {{.*}} to <2 x i64>
|
|
; CHECK: icmp ne <2 x i64> {{.*}}, zeroinitializer
|
|
; CHECK: sext <2 x i1> {{.*}} to <2 x i64>
|
|
; CHECK: lshr <2 x i64> {{.*}}, <i64 48, i64 48>
|
|
; CHECK: ret <2 x i64>
|
|
|
|
|
|
define x86_mmx @Test_x86_mmx_psad_bw(x86_mmx %a, x86_mmx %b) sanitize_memory {
|
|
entry:
|
|
%c = tail call x86_mmx @llvm.x86.mmx.psad.bw(x86_mmx %a, x86_mmx %b) nounwind
|
|
ret x86_mmx %c
|
|
}
|
|
|
|
; CHECK-LABEL: @Test_x86_mmx_psad_bw(
|
|
; CHECK: or i64
|
|
; CHECK: icmp ne i64
|
|
; CHECK: sext i1 {{.*}} to i64
|
|
; CHECK: lshr i64 {{.*}}, 48
|
|
; CHECK: ret x86_mmx
|