[SLP] Fix insert point for reused extract instructions.

Summary:
Reworked the previously committed patch to insert shuffles for reused
extract element instructions in the correct position. Previous logic was
incorrect, and might lead to the crash with PHIs and EH instructions.

Reviewers: efriedma, javed.absar

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D50143

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339166 91177308-0d34-0410-b5e6-96231b3b80d8
2 files changed