[PATCH] D133898: [IR] Remove IntrArgMemOnly from vp.gather/scatter.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 14 14:26:05 PDT 2022
craig.topper created this revision.
craig.topper added reviewers: reames, simoll, rogfer01, efriedma, nikic.
Herald added a subscriber: StephenFan.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added a subscriber: jdoerfert.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D133898
Files:
llvm/include/llvm/IR/Intrinsics.td
llvm/test/Transforms/GVN/vp_gather_scatter.ll
Index: llvm/test/Transforms/GVN/vp_gather_scatter.ll
===================================================================
--- llvm/test/Transforms/GVN/vp_gather_scatter.ll
+++ 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)
Index: llvm/include/llvm/IR/Intrinsics.td
===================================================================
--- llvm/include/llvm/IR/Intrinsics.td
+++ llvm/include/llvm/IR/Intrinsics.td
@@ -1437,14 +1437,14 @@
[ 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<[],
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133898.460231.patch
Type: text/x-patch
Size: 2791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220914/6b294b59/attachment.bin>
More information about the llvm-commits
mailing list