[PATCH] D118345: [AArch64][SVE] Add more folds to make use of gather/scatter with 32-bit indices

Caroline via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 2 05:50:25 PST 2022


CarolineConcatto added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:16182
+      Index.getOperand(0).getOperand(0).getOpcode() == ISD::STEP_VECTOR) {
+    if (auto Shift = DAG.getSplatValue(Index.getOperand(1)))
+      if (auto Offset = DAG.getSplatValue(Index.getOperand(0).getOperand(1))) {
----------------
sdesmalen wrote:
> Does the following work:
> 
>   if (auto *Shift = dyn_cast_or_null<ConstantSDNode>(DAG.getSplatValue(Index.getOperand(1))) {
>     ..
>   }
> 
> ?
> 
> If so, that removes the need to do `auto *C = dyn_cast<ConstantSDNode>(Shift)` and the return if C == nullptr.
I can, but I will use Shift later on:
Offset = DAG.getNode(ISD::SHL, DL, MVT::i64, Offset, Shift);
My skills may  not be the best. But I believe that I cannot use  Shift as a ConstantSDNode when setting Offset.
I believe I need to make Shift  be a splat of vscale type again.
I don't think this would be  better than now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118345



More information about the llvm-commits mailing list