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

    <tr>
        <th>Summary</th>
        <td>
            Runtime of internal test case increased dramatically after SLP change
        </td>
    </tr>

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

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

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

<pre>
    An internal test case (C++ and LLVM IR attached), takes over 78 min to run after the following commit. Previously, it completed in about 2 min. On current master, the situation has improved substantially, but is still dramatically slower at just over 15 min. I noticed that there's been performance-related discussions on the original review, so I hope the attached test case will be useful for further investigation. It isn't small, but its structure is regular: [test.zip](https://github.com/llvm/llvm-project/files/9822830/test.zip)

```
  commit 7ea03f0b4e4ec5d91d48ba2976f5adc299089ffd
  Author: Alexey Bataev <a.bataev@outlook.com>
  Date:   Thu Nov 18 08:08:01 2021 -0800

      [SLP]Improve reductions analysis and emission, part 1.
```
##### After 7ea03f0b:
```
$ time opt -slp-vectorizer -o out.ll test.ll
real    78m7.682s
user    78m7.299s
sys     0m0.236s
$
```
##### Before 7ea03f0b:
```
$ time opt -S -slp-vectorizer test.ll -o slp-opt.ll
real    1m42.031s
user    1m41.980s
sys     0m0.048s
$
```

##### Current master:
```
$ time opt -S -slp-vectorizer test.ll -o slp-opt.ll
real    15m34.115s
user    15m33.978s
sys     0m0.096s
$
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1VNuO2zYQ_Rr5ZWCBomSJetCDdzcBFti2QVLknZJGFhOKMnjx1vn6Dun1dpsYSPNQgRAlXmbOOXPp1_Hc7Q0o49EaqcGj8zBIh5BxcZ_xOxogzQhPT59_g8ePIL2Xw4xjxtuM34OXX9HBekILjYBFGfAr2GBATmQR_IwwrVqvz8ocYFiXRfkcPlg8qTU4fY4mlI8bR40eRwICsl-DBx6N5fCHgSF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