[SLPVectorizer] Do not assume extracelement idx is a ConstantInt.
authorFlorian Hahn <flo@fhahn.com>
Tue, 18 Feb 2020 16:23:01 +0000 (17:23 +0100)
committerFlorian Hahn <flo@fhahn.com>
Tue, 18 Feb 2020 17:16:06 +0000 (18:16 +0100)
commite32522ca178acc42e26f21d64ef8fc180ad772bd
treea12ed2cbb0f0e3f3c49115c76ba8c392b8f5e5b4
parentaa3e99dc859febba398925afeefb118403e15ab9
[SLPVectorizer] Do not assume extracelement idx is a ConstantInt.

The index of an ExtractElementInst is not guaranteed to be a
ConstantInt. It can be any integer value. Check explicitly for
ConstantInts.

The new test cases illustrate scenarios where we crash without
this patch. I've also added another test case to check the matching
of extractelement vector ops works.

Reviewers: RKSimon, ABataev, dtemirbulatov, vporpo

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D74758
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/X86/lookahead.ll