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

Caroline via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 7 02:01:30 PST 2022


CarolineConcatto added inline comments.


================
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) {
----------------
sdesmalen wrote:
> Splat pointer?
Yes, you are correct. It is pointer. Missed that


================
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
----------------
sdesmalen wrote:
> just write: `<2 x i64*> <i64* %src, i64* %src>`
I believe this does not work, because src needs to be a constant.
I need to use gep and inserts in each position of the vector. That is the same as doing a splat


================
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) {
----------------
sdesmalen wrote:
> I think you can remove this test, because it's unaffected by your patch.
That is not true. I added these lines:
  auto *ConstMask = dyn_cast<Constant>(II.getArgOperand(2));
  if (!ConstMask)
    return nullptr;


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