[PATCH] D120894: [AArch64][SVE]Make better use of gather/scatter when inside a loop body

Caroline via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 7 00:28:16 PST 2022


CarolineConcatto added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:12306
+    // and not check stepvector
+    IntrinsicInst *II = dyn_cast<IntrinsicInst>(I->getOperand(1));
+    if (II && II->getIntrinsicID() == Intrinsic::experimental_stepvector) {
----------------
sdesmalen wrote:
> This doesn't need to be limited to the second operand. You can just combine it with the case for splat.
Step vector will always be the second operand, because the work you did in 
https://reviews.llvm.org/D118459


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:12313-12315
+        auto Ext1 = cast<Instruction>(I->getOperand(i));
+        Ops.push_back(&Ext1->getOperandUse(0));
+        Ops.push_back(&I->getOperandUse(i));
----------------
sdesmalen wrote:
> I'm a bit confused about what this is doing, it seems like this is adding:
> 
>   I->getOperand(i)->getOperandUse(0);
>   I->getOperandUse(i);
> 
> is that correct?
> 
> I notice it also hasn't checked the other operand yet before it returns `true`.
> 
> What I think you want to do is:
> * First check if `I` is used by a GEP in some way.
> * Then iterate through each of the operands, adding it to Ops if it's either a splat/stepvector.
> * If any splats/stepvectors have been found, return.
If it is a splat suffle it needs to get the shutter and the insert.
I->getOperand(i)->getOperandUse(0); -> insert element in position 0  
I->getOperandUse(i); -> is the suffle of the insert
If we only push the shuffle, the optimisation does not see it as a splat further in the line.

I believe now it checks  all operands that need to be checked.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120894



More information about the llvm-commits mailing list