1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
2 ; RUN: opt -passes=inline -enable-noalias-to-md-conversion -S < %s | FileCheck %s
3 ; RUN: opt -aa-pipeline=basic-aa -passes=inline -enable-noalias-to-md-conversion -S < %s | FileCheck %s
4 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1) #0
10 define void @hello(ptr noalias nocapture %a, ptr noalias nocapture readonly %c, ptr nocapture %b) #1 {
11 ; CHECK-LABEL: define {{[^@]+}}@hello
12 ; CHECK-SAME: (ptr noalias nocapture [[A:%.*]], ptr noalias nocapture readonly [[C:%.*]], ptr nocapture [[B:%.*]]) #[[ATTR2:[0-9]+]] {
14 ; CHECK-NEXT: [[L:%.*]] = alloca i8, i32 512, align 1
15 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[A]], ptr align 16 [[B]], i64 16, i1 false)
16 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[B]], ptr align 16 [[C]], i64 16, i1 false)
17 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[A]], ptr align 16 [[C]], i64 16, i1 false)
18 ; CHECK-NEXT: call void @hey()
19 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[L]], ptr align 16 [[C]], i64 16, i1 false)
20 ; CHECK-NEXT: ret void
23 %l = alloca i8, i32 512, align 1
24 call void @llvm.memcpy.p0.p0.i64(ptr align 16 %a, ptr align 16 %b, i64 16, i1 0)
25 call void @llvm.memcpy.p0.p0.i64(ptr align 16 %b, ptr align 16 %c, i64 16, i1 0)
26 call void @llvm.memcpy.p0.p0.i64(ptr align 16 %a, ptr align 16 %c, i64 16, i1 0)
28 call void @llvm.memcpy.p0.p0.i64(ptr align 16 %l, ptr align 16 %c, i64 16, i1 0)
32 define void @foo(ptr nocapture %a, ptr nocapture readonly %c, ptr nocapture %b) #2 {
33 ; CHECK-LABEL: define {{[^@]+}}@foo
34 ; CHECK-SAME: (ptr nocapture [[A:%.*]], ptr nocapture readonly [[C:%.*]], ptr nocapture [[B:%.*]]) #[[ATTR3:[0-9]+]] {
36 ; CHECK-NEXT: [[L_I:%.*]] = alloca i8, i32 512, align 1
37 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META0:![0-9]+]])
38 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META3:![0-9]+]])
39 ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 512, ptr [[L_I]])
40 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[A]], ptr align 16 [[B]], i64 16, i1 false), !noalias !3
41 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[B]], ptr align 16 [[C]], i64 16, i1 false), !noalias !0
42 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[A]], ptr align 16 [[C]], i64 16, i1 false), !alias.scope !5
43 ; CHECK-NEXT: call void @hey(), !noalias !5
44 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[L_I]], ptr align 16 [[C]], i64 16, i1 false), !noalias !0
45 ; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 512, ptr [[L_I]])
46 ; CHECK-NEXT: ret void
49 tail call void @hello(ptr %a, ptr %c, ptr %b)
53 define void @hello_cs(ptr nocapture %a, ptr nocapture readonly %c, ptr nocapture %b) #1 {
54 ; CHECK-LABEL: define {{[^@]+}}@hello_cs
55 ; CHECK-SAME: (ptr nocapture [[A:%.*]], ptr nocapture readonly [[C:%.*]], ptr nocapture [[B:%.*]]) #[[ATTR2]] {
57 ; CHECK-NEXT: [[L:%.*]] = alloca i8, i32 512, align 1
58 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[A]], ptr align 16 [[B]], i64 16, i1 false)
59 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[B]], ptr align 16 [[C]], i64 16, i1 false)
60 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[A]], ptr align 16 [[C]], i64 16, i1 false)
61 ; CHECK-NEXT: call void @hey()
62 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[L]], ptr align 16 [[C]], i64 16, i1 false)
63 ; CHECK-NEXT: ret void
66 %l = alloca i8, i32 512, align 1
67 call void @llvm.memcpy.p0.p0.i64(ptr align 16 %a, ptr align 16 %b, i64 16, i1 0)
68 call void @llvm.memcpy.p0.p0.i64(ptr align 16 %b, ptr align 16 %c, i64 16, i1 0)
69 call void @llvm.memcpy.p0.p0.i64(ptr align 16 %a, ptr align 16 %c, i64 16, i1 0)
71 call void @llvm.memcpy.p0.p0.i64(ptr align 16 %l, ptr align 16 %c, i64 16, i1 0)
75 define void @foo_cs(ptr nocapture %a, ptr nocapture readonly %c, ptr nocapture %b) #2 {
76 ; CHECK-LABEL: define {{[^@]+}}@foo_cs
77 ; CHECK-SAME: (ptr nocapture [[A:%.*]], ptr nocapture readonly [[C:%.*]], ptr nocapture [[B:%.*]]) #[[ATTR3]] {
79 ; CHECK-NEXT: [[L_I:%.*]] = alloca i8, i32 512, align 1
80 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META6:![0-9]+]])
81 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META9:![0-9]+]])
82 ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 512, ptr [[L_I]])
83 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[A]], ptr align 16 [[B]], i64 16, i1 false), !noalias !9
84 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[B]], ptr align 16 [[C]], i64 16, i1 false), !noalias !6
85 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[A]], ptr align 16 [[C]], i64 16, i1 false), !alias.scope !11
86 ; CHECK-NEXT: call void @hey(), !noalias !11
87 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[L_I]], ptr align 16 [[C]], i64 16, i1 false), !noalias !6
88 ; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 512, ptr [[L_I]])
89 ; CHECK-NEXT: ret void
92 tail call void @hello_cs(ptr noalias %a, ptr noalias %c, ptr %b)
96 attributes #0 = { argmemonly nofree nosync nounwind willreturn }
97 attributes #1 = { argmemonly nounwind willreturn }
98 attributes #2 = { nounwind }
99 attributes #3 = { nounwind uwtable }
102 ; CHECK: !1 = distinct !{!1, !2, !"hello: %a"}
103 ; CHECK: !2 = distinct !{!2, !"hello"}
105 ; CHECK: !4 = distinct !{!4, !2, !"hello: %c"}
106 ; CHECK: !5 = !{!1, !4}
109 ; CHECK: !7 = distinct !{!7, !8, !"hello_cs: %a"}
110 ; CHECK: !8 = distinct !{!8, !"hello_cs"}
112 ; CHECK: !10 = distinct !{!10, !8, !"hello_cs: %c"}
113 ; CHECK: !11 = !{!7, !10}