1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=msan < %s | FileCheck %s
4 target triple = "x86_64-unknown-linux-gnu"
6 define void @test_memcpy(ptr %p, ptr byval(i32) %p2) sanitize_memory {
7 ; CHECK-LABEL: @test_memcpy(
8 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P2:%.*]] to i64
9 ; CHECK-NEXT: [[TMP2:%.*]] = xor i64 [[TMP1]], 87960930222080
10 ; CHECK-NEXT: [[TMP3:%.*]] = inttoptr i64 [[TMP2]] to ptr
11 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[TMP3]], ptr align 4 inttoptr (i64 add (i64 ptrtoint (ptr @__msan_param_tls to i64), i64 8) to ptr), i64 4, i1 false)
12 ; CHECK-NEXT: call void @llvm.donothing()
13 ; CHECK-NEXT: [[TMP4:%.*]] = call ptr @__msan_memcpy(ptr [[P:%.*]], ptr [[P2]], i64 4)
14 ; CHECK-NEXT: ret void
16 call void @llvm.memcpy.p0.p0.i64(ptr %p, ptr %p2, i64 4, i1 false)
20 define void @test_memmove(ptr %p, ptr byval(i32) %p2) sanitize_memory {
21 ; CHECK-LABEL: @test_memmove(
22 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P2:%.*]] to i64
23 ; CHECK-NEXT: [[TMP2:%.*]] = xor i64 [[TMP1]], 87960930222080
24 ; CHECK-NEXT: [[TMP3:%.*]] = inttoptr i64 [[TMP2]] to ptr
25 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[TMP3]], ptr align 4 inttoptr (i64 add (i64 ptrtoint (ptr @__msan_param_tls to i64), i64 8) to ptr), i64 4, i1 false)
26 ; CHECK-NEXT: call void @llvm.donothing()
27 ; CHECK-NEXT: [[TMP4:%.*]] = call ptr @__msan_memmove(ptr [[P:%.*]], ptr [[P2]], i64 4)
28 ; CHECK-NEXT: ret void
30 call void @llvm.memmove.p0.p0.i64(ptr %p, ptr %p2, i64 4, i1 false)
34 declare void @llvm.memcpy.p0.p0.i64(ptr, ptr, i64, i1)
35 declare void @llvm.memmove.p0.p0.i64(ptr, ptr, i64, i1)