xref: /llvm-project/llvm/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll (revision 6402fc22e1bccd0984beadfe931511175bac688c)
1; RUN: opt -aa-pipeline=tbaa,basic-aa -passes=gvn -S < %s | FileCheck %s
2
3target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32"
4
5; TBAA should prove that these calls don't interfere, since they are
6; IntrArgReadMem and have TBAA metadata.
7
8; CHECK:      define <8 x i16> @test0(ptr %p, ptr %q, <8 x i16> %y, <8 x i1> %m, <8 x i16> %pt) {
9; CHECK-NEXT: entry:
10; CHECK-NEXT:   %a = call <8 x i16> @llvm.masked.load.v8i16.p0(ptr %p, i32 16, <8 x i1> %m, <8 x i16> %pt) [[NUW:#[0-9]+]]
11; CHECK-NEXT:   call void @llvm.masked.store.v8i16.p0(<8 x i16> %y, ptr %q, i32 16, <8 x i1> %m)
12; CHECK-NEXT:   %c = add <8 x i16> %a, %a
13define <8 x i16> @test0(ptr %p, ptr %q, <8 x i16> %y, <8 x i1> %m, <8 x i16> %pt) {
14entry:
15  %a = call <8 x i16> @llvm.masked.load.v8i16.p0(ptr %p, i32 16, <8 x i1> %m, <8 x i16> %pt) nounwind, !tbaa !2
16  call void @llvm.masked.store.v8i16.p0(<8 x i16> %y, ptr %q, i32 16, <8 x i1> %m), !tbaa !1
17  %b = call <8 x i16> @llvm.masked.load.v8i16.p0(ptr %p, i32 16, <8 x i1> %m, <8 x i16> %pt) nounwind, !tbaa !2
18  %c = add <8 x i16> %a, %b
19  ret <8 x i16> %c
20}
21
22declare <8 x i16> @llvm.masked.load.v8i16.p0(ptr, i32, <8 x i1>, <8 x i16>) nounwind readonly
23declare void @llvm.masked.store.v8i16.p0(<8 x i16>, ptr, i32, <8 x i1>) nounwind
24
25; CHECK: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
26; CHECK: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: write) }
27; CHECK: attributes [[NUW]] = { nounwind }
28
29!0 = !{!"tbaa root"}
30!1 = !{!3, !3, i64 0}
31!2 = !{!4, !4, i64 0}
32!3 = !{!"A", !0}
33!4 = !{!"B", !0}
34