[llvm] 6384044 - [GVN][VP] Add test case for incorrect removal of a vp.gather. NFC

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


Author: Craig Topper
Date: 2022-09-14T15:00:07-07:00
New Revision: 6384044df4ef1474e0808d865fa6fce328a18578

URL: https://github.com/llvm/llvm-project/commit/6384044df4ef1474e0808d865fa6fce328a18578
DIFF: https://github.com/llvm/llvm-project/commit/6384044df4ef1474e0808d865fa6fce328a18578.diff

LOG: [GVN][VP] Add test case for incorrect removal of a vp.gather. NFC

Pre-commit for D133898

Reviewed By: reames

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

Added: 
    llvm/test/Transforms/GVN/vp_gather_scatter.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/GVN/vp_gather_scatter.ll b/llvm/test/Transforms/GVN/vp_gather_scatter.ll
new file mode 100644
index 0000000000000..d19ef7c5e1bdc
--- /dev/null
+++ b/llvm/test/Transforms/GVN/vp_gather_scatter.ll
@@ -0,0 +1,22 @@
+; 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.
+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]]
+;
+  %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)
+  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)
+  %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)
+  ret <vscale x 8 x i32> %c
+}
+
+declare <vscale x 8 x i32> @llvm.vp.add.nxv8i32(<vscale x 8 x i32>, <vscale x 8 x i32>, <vscale x 8 x i1>, i32)
+declare <vscale x 8 x i32> @llvm.vp.gather.nxv8i32.nxv8p0(<vscale x 8 x ptr>, <vscale x 8 x i1>, i32)
+declare void @llvm.vp.scatter.nxv8i32.nxv8p0(<vscale x 8 x i32>, <vscale x 8 x ptr>, <vscale x 8 x i1>, i32)
+


        


More information about the llvm-commits mailing list