[PATCH] D78895: [InstCombine][SVE] Fix visitInsertElementInst for scalable type.

Huihui Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 26 21:46:54 PDT 2020


huihuiz created this revision.
huihuiz added reviewers: sdesmalen, efriedma, spatel, nikic.
huihuiz added a project: LLVM.
Herald added subscribers: psnobl, rkruppe, hiraditya, tschuett.

This patch fixes the following issues in visitInsertElementInst:

1. Bail out for scalable type when analysis requires fixed size number of vector elements.
2. Use cast<FixedVectorType> to get vector number of elements. This ensure assertion on scalable vector type.
3. Use ShuffleVectorInst::getShuffleMask().size() to get number of elements from a shuffle mask.
4. For scalable type, avoid folding a chain of insertelement into splat: insertelt(insertelt(insertelt(insertelt X, %k, 0), %k, 1), %k, 2) ... -> shufflevector(insertelt(X, %k, 0), undef, zero) The length of scalable vector is unknown at compile-time, therefore we don't know if given insertelement sequence is valid for splat.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78895

Files:
  llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  llvm/test/Transforms/InstCombine/vscale_insertelement.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78895.260212.patch
Type: text/x-patch
Size: 8723 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200427/39f39459/attachment.bin>


More information about the llvm-commits mailing list