[PATCH] D115726: [InstCombine] Fold for masked gather when loading the same value each time.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 6 03:37:59 PST 2022


sdesmalen added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/masked_intrinsics.ll:273
+
+
+;; Splat Value and all active mask
----------------
nit: add `Test gathers that can be simplified to scalar load + splat`


================
Comment at: llvm/test/Transforms/InstCombine/masked_intrinsics.ll:274
+
+;; Splat Value and all active mask
+define <vscale x 2 x i64> @gather_nxv2i64_uniform_ptrs_all_active_mask(i64* %src) {
----------------
Splat pointer?


================
Comment at: llvm/test/Transforms/InstCombine/masked_intrinsics.ll:297
+  %broadcast.splat = shufflevector <2 x i64*> %broadcast.splatinsert, <2 x i64*> poison, <2 x i32> zeroinitializer
+  %res = call <2 x i64> @llvm.masked.gather.v2i64(<2 x i64*> %broadcast.splat, i32 8, <2 x i1> <i1 1, i1 1>, <2 x i64> undef)
+  ret <2 x i64> %res
----------------
just write: `<2 x i64*> <i64* %src, i64* %src>`


================
Comment at: llvm/test/Transforms/InstCombine/masked_intrinsics.ll:300
+}
+
+;; Vector of pointers is not a splat.
----------------
nit: can you add a comment here that these are negative tests?
(and change the name of the functions to `@negative_gather_...`)



================
Comment at: llvm/test/Transforms/InstCombine/masked_intrinsics.ll:328
+
+;; Splat Value and all inactive mask
+define <2 x i64> @gather_v2i64_uniform_ptrs_all_inactive_mask(i64* %src) {
----------------
I think you can remove this test, because it's unaffected by your patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115726/new/

https://reviews.llvm.org/D115726



More information about the llvm-commits mailing list