xref: /llvm-project/llvm/test/Transforms/InstCombine/bcopy.ll (revision 2caaec65c04ea7d0e9568b7895b7a46d6100cb75)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -passes=instcombine -data-layout=p:32:32 -S | FileCheck %s
3
4declare void @bcopy(ptr nocapture readonly, ptr nocapture, i32)
5
6define void @bcopy_memmove(ptr nocapture readonly %a, ptr nocapture %b) {
7; CHECK-LABEL: @bcopy_memmove(
8; CHECK-NEXT:    [[TMP1:%.*]] = load i64, ptr [[A:%.*]], align 1
9; CHECK-NEXT:    store i64 [[TMP1]], ptr [[B:%.*]], align 1
10; CHECK-NEXT:    ret void
11;
12  tail call void @bcopy(ptr %a, ptr %b, i32 8)
13  ret void
14}
15
16define void @bcopy_memmove2(ptr nocapture readonly %a, ptr nocapture %b, i32 %len) {
17; CHECK-LABEL: @bcopy_memmove2(
18; CHECK-NEXT:    tail call void @llvm.memmove.p0.p0.i32(ptr align 1 [[B:%.*]], ptr align 1 [[A:%.*]], i32 [[LEN:%.*]], i1 false)
19; CHECK-NEXT:    ret void
20;
21  tail call void @bcopy(ptr %a, ptr %b, i32 %len)
22  ret void
23}
24