[PATCH] D37880: Fix an out-of-bounds shufflevector index bug

George Burgess IV via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 14 18:24:19 PDT 2017


george.burgess.iv created this revision.
Herald added subscribers: javed.absar, srhines.

I'm somewhat confident about my fix on its own, but I'm not at all familiar with vector instructions. Since I had to modify existing tests, please take a look. :)

Bug: `MaxIndex` represents the maximum index we're passing to ShuffleVector. If it's a power of two, we can end up splitting into two vectors which have a total size == `MaxIndex`. This caused an assertion failure in `SelectionDAG::getVectorShuffle`:

  Assertion `llvm::all_of(Mask, [&](int M) { return M < (NElts * 2); }) && "Index out of range"' failed

(`NElts == 4`, and `Mask == {0, 8, -1, -1}`)


https://reviews.llvm.org/D37880

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/ARM/crash-on-pow2-shufflevector.ll
  test/CodeGen/X86/avx512-shuffles/partial_permute.ll
  test/CodeGen/X86/vector-shuffle-512-v8.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37880.115332.patch
Type: text/x-patch
Size: 7377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170915/705b29e3/attachment.bin>


More information about the llvm-commits mailing list