[PATCH] D107966: [SLP]Do not emit extract elements for insertelements users, replace with shuffles directly.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 05:09:16 PDT 2022


fhahn added a comment.

In D107966#3533961 <https://reviews.llvm.org/D107966#3533961>, @ABataev wrote:

> In D107966#3533907 <https://reviews.llvm.org/D107966#3533907>, @fhahn wrote:
>
>> In D107966#3533879 <https://reviews.llvm.org/D107966#3533879>, @ABataev wrote:
>>
>>> Could you check one more time, please?
>>
>> Yeah I just checked and this crashes for me with a release + assert build (commit is 96323c9f4c10bef5cb5d527970cabc73eab8aa21 <https://reviews.llvm.org/rG96323c9f4c10bef5cb5d527970cabc73eab8aa21>)
>>
>> The assertion is: `Assertion failed: (II && "Must be an insertelement instruction."), function vectorizeTree, file SLPVectorizer.cpp, line 8543.`
>
> Still unable to reproduce but I'll try to investigate it.

I'm building on macOS which defaults to using libc++. It's possible that this may be the reason why you are not seeing the crash. I left an inline comment for a `sort` call. Replacing this with `stable_sort` fixes the crash.



================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:8489
+    // Find the first and the last instruction in the list of insertelements.
+    sort(ShuffledInserts[I].InsertElements, isFirstInsertElement);
+    InsertElementInst *FirstInsert = ShuffledInserts[I].InsertElements.front();
----------------
Is it possible that the relative order of elements that compare as equal matters in the code below? With stable_sort, I am not seeing the crash.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107966



More information about the llvm-commits mailing list