[PATCH] D115724: [InstCombine] Fold for masked scatters to a uniform address

Caroline via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 16 05:32:31 PST 2021


CarolineConcatto added a comment.

Thank you @sdesmalen and @david-arm.
I believe both folds:

1. The pointer is a splat(), the value is not a splat, the mask is an all-active mask.
2. The pointer is a splat(), the value is a splat(), the mask is not all-inactive (but not necessarily all active). are now implemented.

I noticed that for option 2 (when the value is a splat) in the extract element the value is the same as the original value that was splatted.
So in case 2, the fold is to a scalar store of value in the destination pointer.  I don't need to extract the element from any line.
So I only have:
StoreInst *S = new StoreInst(SplatValue, SplatPtr, false, Alignment);
I also added the same tests for fixed  and scalable vector.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:386
+          ConstantInt::get(Builder.getInt32Ty(), VF.getKnownMinValue());
+      Value *RunTimeVF = Builder.CreateVScale(EC);
+      // LastLane = RunTimeVF - 1
----------------
sdesmalen wrote:
> This is only valid if the the type is a `ScalableVectorType`
I believe this fold should also work for fixed vector.  
So I've update it to work for fixed vector too.
And I added tests for it as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115724



More information about the llvm-commits mailing list