llvm.org GIT mirror llvm / ecc0989
Merging r280143: ------------------------------------------------------------------------ r280143 | dberlin | 2016-08-30 12:58:48 -0700 (Tue, 30 Aug 2016) | 2 lines IntrArgMemOnly is only defined (and current AA machinery only sanely supports) pointer arguments, and these intrinsics have vector of pointer arguments. Remove ArgMemOnly until we either have the machinery, define a new attribute, or something similar ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_39@287777 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 2 years ago
2 changed file(s) with 44 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
667667 [LLVMVectorOfPointersToElt<0>, llvm_i32_ty,
668668 LLVMVectorSameWidth<0, llvm_i1_ty>,
669669 LLVMMatchType<0>],
670 [IntrReadMem, IntrArgMemOnly]>;
670 [IntrReadMem]>;
671671
672672 def int_masked_scatter: Intrinsic<[],
673673 [llvm_anyvector_ty,
674674 LLVMVectorOfPointersToElt<0>, llvm_i32_ty,
675 LLVMVectorSameWidth<0, llvm_i1_ty>],
676 [IntrArgMemOnly]>;
675 LLVMVectorSameWidth<0, llvm_i1_ty>]>;
677676
678677 // Test whether a pointer is associated with a type metadata identifier.
679678 def int_type_test : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty, llvm_metadata_ty],
0 ; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
1
2 declare void @llvm.masked.scatter.v2i32(<2 x i32> , <2 x i32*> , i32 , <2 x i1> )
3 declare <2 x i32> @llvm.masked.gather.v2i32(<2 x i32*>, i32, <2 x i1>, <2 x i32>)
4
5 ; This test ensures that masked scatter and gather operations, which take vectors of pointers,
6 ; do not have pointer aliasing ignored when being processed.
7 ; No scatter/gather calls should end up eliminated
8 ; CHECK: llvm.masked.gather
9 ; CHECK: llvm.masked.gather
10 ; CHECK: llvm.masked.scatter
11 ; CHECK: llvm.masked.gather
12 ; CHECK: llvm.masked.scatter
13 ; CHECK: llvm.masked.gather
14 define spir_kernel void @test(<2 x i32*> %in1, <2 x i32*> %in2, i32* %out) {
15 entry:
16 ; Just some temporary storage
17 %tmp.0 = alloca i32
18 %tmp.1 = alloca i32
19 %tmp.i = insertelement <2 x i32*> undef, i32* %tmp.0, i32 0
20 %tmp = insertelement <2 x i32*> %tmp.i, i32* %tmp.1, i32 1
21 ; Read from in1 and in2
22 %in1.v = call <2 x i32> @llvm.masked.gather.v2i32(<2 x i32*> %in1, i32 1, <2 x i1> , <2 x i32> undef) #1
23 %in2.v = call <2 x i32> @llvm.masked.gather.v2i32(<2 x i32*> %in2, i32 1, <2 x i1> , <2 x i32> undef) #1
24 ; Store in1 to the allocas
25 call void @llvm.masked.scatter.v2i32(<2 x i32> %in1.v, <2 x i32*> %tmp, i32 1, <2 x i1> );
26 ; Read in1 from the allocas
27 ; This gather should alias the scatter we just saw
28 %tmp.v.0 = call <2 x i32> @llvm.masked.gather.v2i32(<2 x i32*> %tmp, i32 1, <2 x i1> , <2 x i32> undef) #1
29 ; Store in2 to the allocas
30 call void @llvm.masked.scatter.v2i32(<2 x i32> %in2.v, <2 x i32*> %tmp, i32 1, <2 x i1> );
31 ; Read in2 from the allocas
32 ; This gather should alias the scatter we just saw, and not be eliminated
33 %tmp.v.1 = call <2 x i32> @llvm.masked.gather.v2i32(<2 x i32*> %tmp, i32 1, <2 x i1> , <2 x i32> undef) #1
34 ; Store in2 to out for good measure
35 %tmp.v.1.0 = extractelement <2 x i32> %tmp.v.1, i32 0
36 %tmp.v.1.1 = extractelement <2 x i32> %tmp.v.1, i32 1
37 store i32 %tmp.v.1.0, i32* %out
38 %out.1 = getelementptr i32, i32* %out, i32 1
39 store i32 %tmp.v.1.1, i32* %out.1
40 ret void
41 }