<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/95925>95925</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [SLP] "Deleting out-of-tree value" assertion triggers in SLP vectorizer
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          momo5502
      </td>
    </tr>
</table>

<pre>
    The following sample triggers the "Deleting out-of-tree value" assertion in SLP vectorizer:

```LLVM
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc19.39.33523"

define fastcc ptr @"testfunc"(ptr %0) {
entry:
  %1 = ptrtoint ptr %0 to i64
  %2 = trunc i64 %1 to i32
  %3 = ptrtoint ptr null to i64
  %4 = trunc i64 %3 to i32
  switch i32 0, label %newFuncRoot994 [
    i32 1, label %newFuncRoot994
    i32 0, label %newFuncRoot584
 ]

newFuncRoot584:                                   ; preds = %entry
  %5 = insertelement <4 x i32> poison, i32 %4, i64 0
  %6 = insertelement <4 x i32> %5, i32 %2, i64 1
  ret ptr null

newFuncRoot994:                                   ; preds = %entry, %entry
  %7 = insertelement <4 x i32> zeroinitializer, i32 %2, i64 %3
  ret ptr null
}
```

https://godbolt.org/z/4j9fonn1d
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVMtu47gS_RpqQ8igitRroUUSX69ygcZkMNsBJZVsNihSICm7k68fkLYTJ-nuYDCGQfFx6lTVYbGk92pvEDtS3pNym8k1HKzrZjvbsmSQ9XZ87v48IJ2s1vakzJ56OS8aaXBqv0fnaTggJQBb1BjiuV1Dbqc8OER6lHpFAkCl9-iCsoYqQ58ev9EjDsE69YKO8DvCtoRdx4qd_4-Pf_3_vBWk22OgowxSy2e7Bkr4NvrEfCb87pQvUDPC7zikIS6L98s4q0QacvU6KaAh_K6AJp8adpmZtFVdzSuRP0UYwLtQglNRg0sYP5rq70rky5CflBntyeezPw5Fu-HthvMS-Kv5eRxxUgbpJH0YBroER4lgBCCgD9NqhgiHJu1DyQi0lNT3Z1M0wT2_KkYjoEhhLMEFq0ygVzMaLI2pvgEhAYNbzRBPzrYRxeEGxT_TmVXrz3TiMx3_QOdPKgyHuEMZgQeqZY86Ag2edqsZ_rA2tK2gsfguJjShi9-g3yN_yVs2VyQpt7fqf8DwRPXFj_B7ujgc_eXKy_M9vIlRpgNlYpWjxhlNLNIHQX8kPfj_6GKVtyZGG8OO-qV5JSi74am-5InObljgylJcWRy-3dov8o4q_pe84eFnGtRfxv6CziqjgpI6vfyfpBGr6DeZ1NsPXeI2w0MIi4-PA3YEdns79laHjXV7ArsXAjvxvZ2sMcWYjR0fW97KDLuiLpq6qCsB2aGTtSxQsHJsoKkn7Ota9rwcsQLBy7rqM9UBA8Gqoik4F4xtWj5VUyFFwZpG8l4QwXCWSm-0Ps7Rd6a8X7FryxbKLBWqT80WwOCJpsP43stt5rpok_fr3hPBtPLBv7EEFXTq0k-P30i5_Tcd97VTf2q92ep090E1FQ5rvxnsTGAXvV8--eLsdxwCgV2K2RPYnXM6dvBPAAAA__8748KW">