Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/MemCpyOpt/no-libcalls.ll
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

67 lines
2.7 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -passes=memcpyopt -mtriple=x86_64 < %s | FileCheck %s --check-prefixes=CHECK,LIBCALLS
; RUN: opt -S -passes=memcpyopt -mtriple=amdgcn-- < %s | FileCheck %s --check-prefixes=CHECK,NO-LIBCALLS
; RUN: opt -S -passes=memcpyopt -mtriple=amdgcn-- -enable-memcpyopt-without-libcalls < %s \
; RUN: | FileCheck %s --check-prefixes=CHECK,LIBCALLS
; REQUIRES: amdgpu-registered-target
; REQUIRES: x86-registered-target
define void @dont_create_memset(ptr %p) {
; LIBCALLS-LABEL: @dont_create_memset(
; LIBCALLS-NEXT: [[P1:%.*]] = getelementptr i32, ptr [[P:%.*]], i64 1
; LIBCALLS-NEXT: [[P2:%.*]] = getelementptr i32, ptr [[P]], i64 2
; LIBCALLS-NEXT: [[P3:%.*]] = getelementptr i32, ptr [[P]], i64 3
; LIBCALLS-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[P]], i8 0, i64 16, i1 false)
; LIBCALLS-NEXT: ret void
;
; NO-LIBCALLS-LABEL: @dont_create_memset(
; NO-LIBCALLS-NEXT: store i32 0, ptr [[P:%.*]], align 4
; NO-LIBCALLS-NEXT: [[P1:%.*]] = getelementptr i32, ptr [[P]], i64 1
; NO-LIBCALLS-NEXT: store i32 0, ptr [[P1]], align 4
; NO-LIBCALLS-NEXT: [[P2:%.*]] = getelementptr i32, ptr [[P]], i64 2
; NO-LIBCALLS-NEXT: store i32 0, ptr [[P2]], align 4
; NO-LIBCALLS-NEXT: [[P3:%.*]] = getelementptr i32, ptr [[P]], i64 3
; NO-LIBCALLS-NEXT: store i32 0, ptr [[P3]], align 4
; NO-LIBCALLS-NEXT: ret void
;
store i32 0, ptr %p
%p1 = getelementptr i32, ptr %p, i64 1
store i32 0, ptr %p1
%p2 = getelementptr i32, ptr %p, i64 2
store i32 0, ptr %p2
%p3 = getelementptr i32, ptr %p, i64 3
store i32 0, ptr %p3
ret void
}
%ty = type { i64 }
define void @dont_create_memcpy(ptr %p1, ptr %p2) {
; LIBCALLS-LABEL: @dont_create_memcpy(
; LIBCALLS-NEXT: call void @llvm.memmove.p0.p0.i64(ptr align 8 [[P2:%.*]], ptr align 8 [[P1:%.*]], i64 8, i1 false)
; LIBCALLS-NEXT: ret void
;
; NO-LIBCALLS-LABEL: @dont_create_memcpy(
; NO-LIBCALLS-NEXT: [[V:%.*]] = load [[TY:%.*]], ptr [[P1:%.*]], align 8
; NO-LIBCALLS-NEXT: store [[TY]] [[V]], ptr [[P2:%.*]], align 8
; NO-LIBCALLS-NEXT: ret void
;
%v = load %ty, ptr %p1
store %ty %v, ptr %p2
ret void
}
define void @forward_memcpy(ptr noalias %p1, ptr noalias %p2, ptr noalias %p3) {
; CHECK-LABEL: @forward_memcpy(
; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[P2:%.*]], ptr [[P1:%.*]], i64 16, i1 false)
; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[P3:%.*]], ptr [[P1]], i64 16, i1 false)
; CHECK-NEXT: ret void
;
call void @llvm.memcpy.p0.p0.i64(ptr %p2, ptr %p1, i64 16, i1 false)
call void @llvm.memcpy.p0.p0.i64(ptr %p3, ptr %p2, i64 16, i1 false)
ret void
}
declare void @llvm.memcpy.p0.p0.i64(ptr, ptr, i64, i1)