[InstCombine] Fix select operand simplification with undef (PR47696)
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 1 Oct 2020 18:57:09 +0000 (20:57 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 1 Oct 2020 19:15:48 +0000 (21:15 +0200)
commit9d1c8c0ba94a273c53829f0800335045e547db88
treed1c23d43ea88dc4edd850ca1a8417724a710a050
parent8d26760a95bae34aa5c1161a1c2ab8c1cdaa10a1
[InstCombine] Fix select operand simplification with undef (PR47696)

When replacing X == Y ? f(X) : Z with X == Y ? f(Y) : Z, make sure
that Y cannot be undef. If it may be undef, we might end up picking
a different value for undef in the comparison and the select
operand.
llvm/lib/Transforms/InstCombine/InstCombineInternal.h
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm/test/Transforms/InstCombine/select-binop-cmp.ll
llvm/test/Transforms/InstCombine/select.ll