[InstCombine] avoid infinite loop from partial undef vectors
authorSanjay Patel <spatel@rotateright.com>
Wed, 7 Apr 2021 16:11:23 +0000 (12:11 -0400)
committerSanjay Patel <spatel@rotateright.com>
Wed, 7 Apr 2021 16:18:12 +0000 (12:18 -0400)
commit1894c6c59e37b47c284f2a5ebb92b73911e71e38
tree55a7a3cea71f008b7ce247031a74923059cd9d46
parent920c0f7e09e2a55a800a181fb9bfe296a8733c89
[InstCombine] avoid infinite loop from partial undef vectors

This fixes the examples from
D99674 and
https://llvm.org/PR49878

The matchers succeed on partial undef/poison vector constants,
but the transform creates a full 'not' (-1) constant, so it
would undo a demanded vector elements change triggered by the
extractelement.

Differential Revision: https://reviews.llvm.org/D100044
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm/test/Transforms/InstCombine/select-extractelement.ll