44 lines · plain
1; XFAIL: *2; RUN: opt < %s -passes=newgvn -S | FileCheck %s3 4declare void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> , <2 x ptr> , i32 , <2 x i1> )5declare <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr>, i32, <2 x i1>, <2 x i32>)6 7; This test ensures that masked scatter and gather operations, which take vectors of pointers,8; do not have pointer aliasing ignored when being processed.9; No scatter/gather calls should end up eliminated10; CHECK: call{{.*}}llvm.masked.gather11; CHECK: call{{.*}}llvm.masked.gather12; CHECK: call{{.*}}llvm.masked.scatter13; CHECK: call{{.*}}llvm.masked.gather14; CHECK: call{{.*}}llvm.masked.scatter15; CHECK: call{{.*}}llvm.masked.gather16define spir_kernel void @test(<2 x ptr> %in1, <2 x ptr> %in2, ptr %out) {17entry:18 ; Just some temporary storage19 %tmp.0 = alloca i3220 %tmp.1 = alloca i3221 %tmp.i = insertelement <2 x ptr> undef, ptr %tmp.0, i32 022 %tmp = insertelement <2 x ptr> %tmp.i, ptr %tmp.1, i32 123 ; Read from in1 and in224 %in1.v = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> %in1, i32 1, <2 x i1> <i1 true, i1 true>, <2 x i32> undef) #125 %in2.v = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> %in2, i32 1, <2 x i1> <i1 true, i1 true>, <2 x i32> undef) #126 ; Store in1 to the allocas27 call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> %in1.v, <2 x ptr> %tmp, i32 1, <2 x i1> <i1 true, i1 true>);28 ; Read in1 from the allocas29 ; This gather should alias the scatter we just saw30 %tmp.v.0 = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> %tmp, i32 1, <2 x i1> <i1 true, i1 true>, <2 x i32> undef) #131 ; Store in2 to the allocas32 call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> %in2.v, <2 x ptr> %tmp, i32 1, <2 x i1> <i1 true, i1 true>);33 ; Read in2 from the allocas34 ; This gather should alias the scatter we just saw, and not be eliminated35 %tmp.v.1 = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> %tmp, i32 1, <2 x i1> <i1 true, i1 true>, <2 x i32> undef) #136 ; Store in2 to out for good measure37 %tmp.v.1.0 = extractelement <2 x i32> %tmp.v.1, i32 038 %tmp.v.1.1 = extractelement <2 x i32> %tmp.v.1, i32 139 store i32 %tmp.v.1.0, ptr %out40 %out.1 = getelementptr i32, ptr %out, i32 141 store i32 %tmp.v.1.1, ptr %out.142 ret void43}44