[PATCH] D127276: [RISCV] Lower build_vector of VID sequence with one inconsistent element to vid and insert_vector_elt.

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 07:55:10 PDT 2022


frasercrmck added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:1914
+  for (size_t i = 0; i < Op.getNumOperands(); i++)
+    if (auto VS = isSimpleVIDSequenceImpl(Op, i))
+      return VS;
----------------
reames wrote:
> This is algorithmically slow.  
> 
> You can achieve the same effect with a direct change to the matching code which allows it to fuzzy match exactly one element.  
> 
> Doing so is non trivial, but once you find the first three non-undefs in the sequence it should be easy to distinguish.
I agree. It seems unfortunate to pessimise almost all BUILD_VECTOR compile times just for this case. Does this really show up in real-world code often enough to warrant this optimization?

Do we really want to match a v256 build vector where only element 148 is out of sequence, for example?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127276



More information about the llvm-commits mailing list