[llvm] r187267 - SLP Vectorier: Don't vectorize really short chains because they are already handled by the SelectionDAG store-vectorizer, which does a better job in deciding when to vectorize.

Hey Nadav,
I’d humbly suggest that rather than use 3 directly, you should add a shared constant between these two passes, so when one changes, the other doesn’t need to be updated. It would also ensure this bit of info about what needs to be updated isn’t only contained in the comments…

Hi Daniel,

Maybe my commit message was not clear. The idea is that the SelectionDAG store vectorizer can only handle pairs. So, the number three means “more than a pair”.


Hi Nadav,


  1. The comment doesn’t make this clear. I would suggest, at a minimum, updating it to mention pairs specifically, to avoid the issue in #2

  2. If the day comes when the selectiondag store vectorizer handles more than pairs, and does so better, is anyone really going to remember this random 3 exists in the other vectorizer?

I would posit, based on experience, the answer is “no” :slight_smile:

Hi Daniel,

Thanks for the review!

  • // The SelectionDAG vectorizer can only handle pairs (trees of height = 2).