[PATCH] D124605: [SelectionDAGBuilder] Don't create MGATHER/MSCATTER with Scale != ElemSize

Paul Walker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 04:02:07 PDT 2022


paulwalker-arm added a comment.

In principle I prefer this route as it means a target doesn't have to support something they never want to use and it'll also allow DAGCombine more time to optimise the parts that cannot be done by the target's gather/scatter instructions themselves.



================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:4409
   uint64_t ScaleVal = DL.getTypeAllocSize(GEP->getResultElementType());
-  if (!isPowerOf2_64(ScaleVal))
+  if (ScaleVal != ElemSize)
     return false;
----------------
Shouldn't we also always allow unit scaling (i.e. `ScaleVal==1`)?  I know there's the `IndexType = ISD::SIGNED_SCALED` oddity, but that's the unnecessary duplication I mentioned before that I have inflight patches to remove (see D123381).


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

https://reviews.llvm.org/D124605



More information about the llvm-commits mailing list