[PATCH] D147713: [RISCV] Combine concat_vectors of loads into strided loads
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 6 09:01:03 PDT 2023
reames added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:11373
+ SDValue Ptr = Ld->getBasePtr();
+ if (Ptr.getOpcode() != ISD::ADD || Ptr.getOperand(0) != CurPtr)
+ return SDValue();
----------------
luke wrote:
> This currently only works for strides that use an incremental pattern, e.g. `p, (+ p stride), (+ (+ p stride) stride), ...`
> A strided load could also be represented with a pointer vector built by stepvector + multiply by stride
Do you have an example here? I'd expect the load pointer operand to be scalar and thus the form you describe would likely have been scalarized.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:11391-11403
+ // A special case is if the stride is exactly the width of one of the loads,
+ // in which case it's contiguous and can be combined into a regular vle
+ // without changing the element size
+ if (auto *ConstStride = dyn_cast<ConstantSDNode>(Stride)) {
+ if (ConstStride->getZExtValue() == BaseLdVT.getFixedSizeInBits() / 8) {
+ SDValue WideLoad =
+ DAG.getLoad(VT, DL, BaseLd->getChain(), BasePtr,
----------------
luke wrote:
> This bit could be target agnostic. I have a copy of a patch locally that puts this in DAGCombiner if that would be a better place
Sounds like a good follow up to me.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147713/new/
https://reviews.llvm.org/D147713
More information about the llvm-commits
mailing list