1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/test/Transforms/RewriteStatepointsForGC/unordered-atomic-memcpy-no-deopt.ll
Artur Pilipenko 31af2fa7ed GC-parseable element atomic memcpy/memmove
This change introduces a GC parseable lowering for element atomic
memcpy/memmove intrinsics. This way runtime can provide an
implementation which can take a safepoint during copy operation.

See "GC-parseable element atomic memcpy/memmove" thread on llvm-dev
for the background and details:
https://groups.google.com/g/llvm-dev/c/NnENHzmX-b8/m/3PyN8Y2pCAAJ

Differential Revision: https://reviews.llvm.org/D88861
2020-10-23 14:06:09 -07:00

53 lines
3.3 KiB
LLVM

; RUN: opt -passes=rewrite-statepoints-for-gc -rs4gc-allow-statepoint-with-no-deopt-info=0 -S < %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-REQUIRE-DEOPT
; RUN: opt -passes=rewrite-statepoints-for-gc -rs4gc-allow-statepoint-with-no-deopt-info=1 -S < %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NO-REQUIRE-DEOPT
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.11.0"
declare void @llvm.memcpy.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)*, i8 addrspace(1)*, i32, i32 immarg)
declare void @llvm.memmove.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)*, i8 addrspace(1)*, i32, i32 immarg)
define void @test_memcpy_no_deopt(i8 addrspace(1)* %src, i64 %src_offset, i8 addrspace(1)* %dest, i64 %dest_offset, i32 %len) gc "statepoint-example" {
; CHECK-LABEL: @test_memcpy_no_deopt
; CHECK-REQUIRE-DEOPT-NOT: @llvm.experimental.gc.statepoint
; CHECK-NO-REQUIRE-DEOPT: @llvm.experimental.gc.statepoint
entry:
%src_derived = getelementptr inbounds i8, i8 addrspace(1)* %src, i64 %src_offset
%dest_derived = getelementptr inbounds i8, i8 addrspace(1)* %dest, i64 %dest_offset
call void @llvm.memcpy.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 %src_derived, i8 addrspace(1)* align 16 %dest_derived, i32 %len, i32 1)
ret void
}
define void @test_memmove_no_deopt(i8 addrspace(1)* %src, i64 %src_offset, i8 addrspace(1)* %dest, i64 %dest_offset, i32 %len) gc "statepoint-example" {
; CHECK-LABEL: @test_memmove_no_deopt
; CHECK-REQUIRE-DEOPT-NOT: @llvm.experimental.gc.statepoint
; CHECK-NO-REQUIRE-DEOPT: @llvm.experimental.gc.statepoint
entry:
%src_derived = getelementptr inbounds i8, i8 addrspace(1)* %src, i64 %src_offset
%dest_derived = getelementptr inbounds i8, i8 addrspace(1)* %dest, i64 %dest_offset
call void @llvm.memmove.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 %src_derived, i8 addrspace(1)* align 16 %dest_derived, i32 %len, i32 1)
ret void
}
define void @test_memcpy_with_deopt(i8 addrspace(1)* %src, i64 %src_offset, i8 addrspace(1)* %dest, i64 %dest_offset, i32 %len) gc "statepoint-example" {
; CHECK-LABEL: @test_memcpy_with_deopt
; CHECK-REQUIRE-DEOPT: @llvm.experimental.gc.statepoint
; CHECK-NO-REQUIRE-DEOPT: @llvm.experimental.gc.statepoint
entry:
%src_derived = getelementptr inbounds i8, i8 addrspace(1)* %src, i64 %src_offset
%dest_derived = getelementptr inbounds i8, i8 addrspace(1)* %dest, i64 %dest_offset
call void @llvm.memcpy.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 %src_derived, i8 addrspace(1)* align 16 %dest_derived, i32 %len, i32 1) [ "deopt"(i32 0) ]
ret void
}
define void @test_memmove_with_deopt(i8 addrspace(1)* %src, i64 %src_offset, i8 addrspace(1)* %dest, i64 %dest_offset, i32 %len) gc "statepoint-example" {
; CHECK-LABEL: @test_memmove_with_deopt
; CHECK-REQUIRE-DEOPT: @llvm.experimental.gc.statepoint
; CHECK-NO-REQUIRE-DEOPT: @llvm.experimental.gc.statepoint
entry:
%src_derived = getelementptr inbounds i8, i8 addrspace(1)* %src, i64 %src_offset
%dest_derived = getelementptr inbounds i8, i8 addrspace(1)* %dest, i64 %dest_offset
call void @llvm.memmove.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 %src_derived, i8 addrspace(1)* align 16 %dest_derived, i32 %len, i32 1) [ "deopt"(i32 0) ]
ret void
}