[SLP]Fix PR61835: Assertion `I->use_empty() && "trying to erase
authorAlexey Bataev <a.bataev@outlook.com>
Fri, 31 Mar 2023 19:29:45 +0000 (12:29 -0700)
committerAlexey Bataev <a.bataev@outlook.com>
Fri, 31 Mar 2023 21:21:19 +0000 (14:21 -0700)
commitc1bcf5dd0a24316c0451dff233b80527fc967c6b
tree6cef2bc5ffb425618446fe96d5d7d7a065169b2e
parentd2a559ffc0dc61b9d7426064bd5076b66d2f96d6
[SLP]Fix PR61835: Assertion `I->use_empty() && "trying to erase
instruction with users."' failed.

If the externally used scalar is part of the tree and is replaced by
extractelement instruction, need to add generated extractelement
instruction to the list of the ExternallyUsedValues to avoid deletion
during vectorization.
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/X86/external-used-across-reductions.ll [new file with mode: 0644]