[PATCH] D147713: [RISCV] Combine concat_vectors of loads into strided loads

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 6 09:47:28 PDT 2023


luke 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();
----------------
reames wrote:
> 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.  
Whoops, not a stepvector, what I meant to say was:

```
%p1offset = mul i64 %stride, 1
%p1 = getelementptr i8, ptr %p, i64 %p1offset

%p2offset = mul i64 %stride, 2
%p2 = getelementptr i8, ptr %p, i64 %p2offset

%p3offset = mul i64 %stride, 3
%p3 = getelementptr i8, ptr %p, i64 %p3offset
```

With that said I haven't seen this being emitted so far, but I'll keep an eye out to see if this or other patterns show up in the wild.


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