llvm/llvm/test/CodeGen/MIR/AArch64/machine-metadata.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=aarch64-linux-gnu -run-pass=none -o - %s | FileCheck %s
--- |
  ; ModuleID = 'test/CodeGen/AArch64/memcpy-scoped-aa.ll'
  source_filename = "test/CodeGen/AArch64/memcpy-scoped-aa.ll"
  target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
  target triple = "aarch64-unknown-linux-gnu"

  define i32 @test_memcpy(ptr nocapture %p, ptr nocapture readonly %q) {
    %p0 = bitcast ptr %p to ptr
    %add.ptr = getelementptr inbounds i32, ptr %p, i64 4
    %p1 = bitcast ptr %add.ptr to ptr
    tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %p0, ptr noundef nonnull align 4 dereferenceable(16) %p1, i64 16, i1 false), !alias.scope !0, !noalias !3
    %v0 = load i32, ptr %q, align 4, !alias.scope !3, !noalias !0
    %q1 = getelementptr inbounds i32, ptr %q, i64 1
    %v1 = load i32, ptr %q1, align 4, !alias.scope !3, !noalias !0
    %add = add i32 %v0, %v1
    ret i32 %add
  }

  define i32 @test_memcpy_inline(ptr nocapture %p, ptr nocapture readonly %q) {
    %p0 = bitcast ptr %p to ptr
    %add.ptr = getelementptr inbounds i32, ptr %p, i64 4
    %p1 = bitcast ptr %add.ptr to ptr
    tail call void @llvm.memcpy.inline.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %p0, ptr noundef nonnull align 4 dereferenceable(16) %p1, i64 16, i1 false), !alias.scope !0, !noalias !3
    %v0 = load i32, ptr %q, align 4, !alias.scope !3, !noalias !0
    %q1 = getelementptr inbounds i32, ptr %q, i64 1
    %v1 = load i32, ptr %q1, align 4, !alias.scope !3, !noalias !0
    %add = add i32 %v0, %v1
    ret i32 %add
  }

  define i32 @test_mempcpy(ptr nocapture %p, ptr nocapture readonly %q) {
    %p0 = bitcast ptr %p to ptr
    %add.ptr = getelementptr inbounds i32, ptr %p, i64 4
    %p1 = bitcast ptr %add.ptr to ptr
    %call = tail call ptr @mempcpy(ptr noundef nonnull align 4 dereferenceable(16) %p0, ptr noundef nonnull align 4 dereferenceable(16) %p1, i64 16), !alias.scope !0, !noalias !3
    %v0 = load i32, ptr %q, align 4, !alias.scope !3, !noalias !0
    %q1 = getelementptr inbounds i32, ptr %q, i64 1
    %v1 = load i32, ptr %q1, align 4, !alias.scope !3, !noalias !0
    %add = add i32 %v0, %v1
    ret i32 %add
  }

  ; Function Attrs: argmemonly nofree nounwind willreturn
  declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

  ; Function Attrs: argmemonly nofree nounwind willreturn
  declare void @llvm.memcpy.inline.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64 immarg, i1 immarg) #0

  declare ptr @mempcpy(ptr, ptr, i64)

  attributes #0 = { argmemonly nofree nounwind willreturn }

  !0 = !{!1}
  !1 = distinct !{!1, !2, !"bax: %p"}
  !2 = distinct !{!2, !"bax"}
  !3 = !{!4}
  !4 = distinct !{!4, !2, !"bax: %q"}

...
---
name:            test_memcpy
machineMetadataNodes:
  - '!9 = distinct !{!9, !7, !"Dst"}'
  - '!10 = !{!1, !9}'
  - '!6 = distinct !{!6, !7, !"Src"}'
  - '!5 = !{!1, !6}'
  - '!11 = !{!4, !6}'
  - '!8 = !{!4, !9}'
  - '!7 = distinct !{!7, !"MemcpyLoweringDomain"}'
body:             |
  bb.0 (%ir-block.0):
    liveins: $x0, $x1

    ; CHECK-LABEL: name: test_memcpy
    ; CHECK: [[COPY:%[0-9]+]]:gpr64common = COPY $x1
    ; CHECK: [[COPY1:%[0-9]+]]:gpr64common = COPY $x0
    ; CHECK: [[LDRQui:%[0-9]+]]:fpr128 = LDRQui [[COPY1]], 1 :: (load (s128) from %ir.p1, align 4, !alias.scope !5, !noalias !8)
    ; CHECK: STRQui killed [[LDRQui]], [[COPY1]], 0 :: (store (s128) into %ir.p0, align 4, !alias.scope !10, !noalias !11)
    ; CHECK: [[LDRWui:%[0-9]+]]:gpr32 = LDRWui [[COPY]], 0 :: (load (s32) from %ir.q, !alias.scope !3, !noalias !0)
    ; CHECK: [[LDRWui1:%[0-9]+]]:gpr32 = LDRWui [[COPY]], 1 :: (load (s32) from %ir.q1, !alias.scope !3, !noalias !0)
    ; CHECK: [[ADDWrr:%[0-9]+]]:gpr32 = ADDWrr killed [[LDRWui]], killed [[LDRWui1]]
    ; CHECK: $w0 = COPY [[ADDWrr]]
    ; CHECK: RET_ReallyLR implicit $w0
    %1:gpr64common = COPY $x1
    %0:gpr64common = COPY $x0
    %2:fpr128 = LDRQui %0, 1 :: (load (s128) from %ir.p1, align 4, !alias.scope !5, !noalias !8)
    STRQui killed %2, %0, 0 :: (store (s128) into %ir.p0, align 4, !alias.scope !10, !noalias !11)
    %3:gpr32 = LDRWui %1, 0 :: (load (s32) from %ir.q, !alias.scope !3, !noalias !0)
    %4:gpr32 = LDRWui %1, 1 :: (load (s32) from %ir.q1, !alias.scope !3, !noalias !0)
    %5:gpr32 = ADDWrr killed %3, killed %4
    $w0 = COPY %5
    RET_ReallyLR implicit $w0

...
---
name:            test_memcpy_inline
machineMetadataNodes:
  - '!10 = !{!1, !9}'
  - '!5 = !{!1, !6}'
  - '!8 = !{!4, !9}'
  - '!9 = distinct !{!9, !7, !"Dst"}'
  - '!11 = !{!4, !6}'
  - '!7 = distinct !{!7, !"MemcpyLoweringDomain"}'
  - '!6 = distinct !{!6, !7, !"Src"}'
body:             |
  bb.0 (%ir-block.0):
    liveins: $x0, $x1

    ; CHECK-LABEL: name: test_memcpy_inline
    ; CHECK: [[COPY:%[0-9]+]]:gpr64common = COPY $x1
    ; CHECK: [[COPY1:%[0-9]+]]:gpr64common = COPY $x0
    ; CHECK: [[LDRQui:%[0-9]+]]:fpr128 = LDRQui [[COPY1]], 1 :: (load (s128) from %ir.p1, align 4, !alias.scope !5, !noalias !8)
    ; CHECK: STRQui killed [[LDRQui]], [[COPY1]], 0 :: (store (s128) into %ir.p0, align 4, !alias.scope !10, !noalias !11)
    ; CHECK: [[LDRWui:%[0-9]+]]:gpr32 = LDRWui [[COPY]], 0 :: (load (s32) from %ir.q, !alias.scope !3, !noalias !0)
    ; CHECK: [[LDRWui1:%[0-9]+]]:gpr32 = LDRWui [[COPY]], 1 :: (load (s32) from %ir.q1, !alias.scope !3, !noalias !0)
    ; CHECK: [[ADDWrr:%[0-9]+]]:gpr32 = ADDWrr killed [[LDRWui]], killed [[LDRWui1]]
    ; CHECK: $w0 = COPY [[ADDWrr]]
    ; CHECK: RET_ReallyLR implicit $w0
    %1:gpr64common = COPY $x1
    %0:gpr64common = COPY $x0
    %2:fpr128 = LDRQui %0, 1 :: (load (s128) from %ir.p1, align 4, !alias.scope !5, !noalias !8)
    STRQui killed %2, %0, 0 :: (store (s128) into %ir.p0, align 4, !alias.scope !10, !noalias !11)
    %3:gpr32 = LDRWui %1, 0 :: (load (s32) from %ir.q, !alias.scope !3, !noalias !0)
    %4:gpr32 = LDRWui %1, 1 :: (load (s32) from %ir.q1, !alias.scope !3, !noalias !0)
    %5:gpr32 = ADDWrr killed %3, killed %4
    $w0 = COPY %5
    RET_ReallyLR implicit $w0

...
---
name:            test_mempcpy
machineMetadataNodes:
  - '!9 = distinct !{!9, !7, !"Dst"}'
  - '!8 = !{!4, !9}'
  - '!5 = !{!1, !6}'
  - '!6 = distinct !{!6, !7, !"Src"}'
  - '!11 = !{!4, !6}'
  - '!7 = distinct !{!7, !"MemcpyLoweringDomain"}'
  - '!10 = !{!1, !9}'
body:             |
  bb.0 (%ir-block.0):
    liveins: $x0, $x1

    ; CHECK-LABEL: name: test_mempcpy
    ; CHECK: [[COPY:%[0-9]+]]:gpr64common = COPY $x1
    ; CHECK: [[COPY1:%[0-9]+]]:gpr64common = COPY $x0
    ; CHECK: [[LDRQui:%[0-9]+]]:fpr128 = LDRQui [[COPY1]], 1 :: (load (s128) from %ir.p1, align 1, !alias.scope !5, !noalias !8)
    ; CHECK: STRQui killed [[LDRQui]], [[COPY1]], 0 :: (store (s128) into %ir.p0, align 1, !alias.scope !10, !noalias !11)
    ; CHECK: [[LDRWui:%[0-9]+]]:gpr32 = LDRWui [[COPY]], 0 :: (load (s32) from %ir.q, !alias.scope !3, !noalias !0)
    ; CHECK: [[LDRWui1:%[0-9]+]]:gpr32 = LDRWui [[COPY]], 1 :: (load (s32) from %ir.q1, !alias.scope !3, !noalias !0)
    ; CHECK: [[ADDWrr:%[0-9]+]]:gpr32 = ADDWrr killed [[LDRWui]], killed [[LDRWui1]]
    ; CHECK: $w0 = COPY [[ADDWrr]]
    ; CHECK: RET_ReallyLR implicit $w0
    %1:gpr64common = COPY $x1
    %0:gpr64common = COPY $x0
    %2:fpr128 = LDRQui %0, 1 :: (load (s128) from %ir.p1, align 1, !alias.scope !5, !noalias !8)
    STRQui killed %2, %0, 0 :: (store (s128) into %ir.p0, align 1, !alias.scope !10, !noalias !11)
    %3:gpr32 = LDRWui %1, 0 :: (load (s32) from %ir.q, !alias.scope !3, !noalias !0)
    %4:gpr32 = LDRWui %1, 1 :: (load (s32) from %ir.q1, !alias.scope !3, !noalias !0)
    %5:gpr32 = ADDWrr killed %3, killed %4
    $w0 = COPY %5
    RET_ReallyLR implicit $w0

...