[llvm] 50a699e - [IR][VP] Remove IntrArgMemOnly from vp.gather/scatter.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 14 15:00:21 PDT 2022


Author: Craig Topper
Date: 2022-09-14T15:00:07-07:00
New Revision: 50a699e36215406e13099dad16190f7580980073

URL: https://github.com/llvm/llvm-project/commit/50a699e36215406e13099dad16190f7580980073
DIFF: https://github.com/llvm/llvm-project/commit/50a699e36215406e13099dad16190f7580980073.diff

LOG: [IR][VP] Remove IntrArgMemOnly from vp.gather/scatter.

IntrArgMemOnly is only valid for intrinsics that use a scalar
pointer argument. These intrinsics use a vector of pointer.

Alias analysis will try to find a scalar pointer argument and
will return incorrect alias results when it doesn't find one.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D133898

Added: 
    

Modified: 
    llvm/include/llvm/IR/Intrinsics.td
    llvm/test/Transforms/GVN/vp_gather_scatter.ll

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index 0d9ed46c9cbe1..dc2f8e3b0420a 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -1437,14 +1437,14 @@ def int_vp_gather: DefaultAttrsIntrinsic<[ llvm_anyvector_ty],
                              [ LLVMVectorOfAnyPointersToElt<0>,
                                LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
                                llvm_i32_ty],
-                             [ IntrReadMem, IntrNoSync, IntrWillReturn, IntrArgMemOnly ]>;
+                             [ IntrReadMem, IntrNoSync, IntrWillReturn]>;
 
 def int_vp_scatter: DefaultAttrsIntrinsic<[],
                              [ llvm_anyvector_ty,
                                LLVMVectorOfAnyPointersToElt<0>,
                                LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
                                llvm_i32_ty],
-                             [ IntrArgMemOnly, IntrNoSync, IntrWillReturn ]>; // TODO allow IntrNoCapture for vectors of pointers
+                             [ IntrNoSync, IntrWillReturn ]>; // TODO allow IntrNoCapture for vectors of pointers
 
 // Experimental strided memory accesses
 def int_experimental_vp_strided_store : DefaultAttrsIntrinsic<[],

diff  --git a/llvm/test/Transforms/GVN/vp_gather_scatter.ll b/llvm/test/Transforms/GVN/vp_gather_scatter.ll
index d19ef7c5e1bdc..b6f78a63f8b67 100644
--- a/llvm/test/Transforms/GVN/vp_gather_scatter.ll
+++ b/llvm/test/Transforms/GVN/vp_gather_scatter.ll
@@ -1,13 +1,14 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt -gvn -S < %s | FileCheck %s
 
-; FIXME: We shouldn't delete the second vp.gather.
+; Make sure we don't delete the second vp.gather.
 define <vscale x 8 x i32> @foo(<vscale x 8 x ptr> %p, <vscale x 8 x i32> %x, <vscale x 8 x i1> %mask, i32 %vl) {
 ; CHECK-LABEL: @foo(
 ; CHECK-NEXT:    [[A:%.*]] = call <vscale x 8 x i32> @llvm.vp.gather.nxv8i32.nxv8p0(<vscale x 8 x ptr> [[P:%.*]], <vscale x 8 x i1> [[MASK:%.*]], i32 [[VL:%.*]])
 ; CHECK-NEXT:    [[B:%.*]] = call <vscale x 8 x i32> @llvm.vp.add.nxv8i32(<vscale x 8 x i32> [[A]], <vscale x 8 x i32> [[X:%.*]], <vscale x 8 x i1> [[MASK]], i32 [[VL]])
 ; CHECK-NEXT:    call void @llvm.vp.scatter.nxv8i32.nxv8p0(<vscale x 8 x i32> [[B]], <vscale x 8 x ptr> [[P]], <vscale x 8 x i1> [[MASK]], i32 [[VL]])
-; CHECK-NEXT:    ret <vscale x 8 x i32> [[A]]
+; CHECK-NEXT:    [[C:%.*]] = call <vscale x 8 x i32> @llvm.vp.gather.nxv8i32.nxv8p0(<vscale x 8 x ptr> [[P]], <vscale x 8 x i1> [[MASK]], i32 [[VL]])
+; CHECK-NEXT:    ret <vscale x 8 x i32> [[C]]
 ;
   %a = call <vscale x 8 x i32> @llvm.vp.gather.nxv8i32.nxv8p0(<vscale x 8 x ptr> %p, <vscale x 8 x i1> %mask, i32 %vl)
   %b = call <vscale x 8 x i32> @llvm.vp.add.nxv8i32(<vscale x 8 x i32> %a, <vscale x 8 x i32> %x, <vscale x 8 x i1> %mask, i32 %vl)


        


More information about the llvm-commits mailing list