[SLP] Fix crash when matching associative reduction for integer min/max.
authorValery N Dmitriev <valery.n.dmitriev@intel.com>
Thu, 11 Mar 2021 19:16:29 +0000 (11:16 -0800)
committerValery N Dmitriev <valery.n.dmitriev@intel.com>
Thu, 11 Mar 2021 19:52:57 +0000 (11:52 -0800)
commit73f94969b29f0154288cbc6f17cc44ea004cc069
treea10e995e035d18c034ad745fa4175a9f114b529c
parente9ba25b59dc23a4dd64a20a7247ba3f209c043ef
[SLP] Fix crash when matching associative reduction for integer min/max.

Associative reduction matcher in SLP begins with select instruction but when
it reached call to llvm.umax (or alike) via def-use chain the latter also matched
as UMax kind. The routine's later code assumes matched instruction to be a select
and thus it merely died on the first encountered cast that did not fit.

Differential Revision: https://reviews.llvm.org/D98432
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/slp-umax-rdx-matcher-crash.ll [new file with mode: 0644]