[InstCombine] don't automatically drop poison-generating flags in SimplifyVectorDeman...
authorSanjay Patel <spatel@rotateright.com>
Mon, 13 Dec 2021 15:02:38 +0000 (10:02 -0500)
committerSanjay Patel <spatel@rotateright.com>
Mon, 13 Dec 2021 15:12:19 +0000 (10:12 -0500)
commitf46a9c8edd4421e875927d6808fea04090e28d37
treea3bd3220416a8e6c9e460364797906cd6429cd48
parent843534db3cc90d4cabaf67b225256ecd53aeb613
[InstCombine] don't automatically drop poison-generating flags in SimplifyVectorDemandedElts

I noticed this while reviewing the test diffs in D115460
(and so the diffs in that patch will be reduced if this one is applied first).

This is effectively a revert of 3436dc29239d ( https://reviews.llvm.org/rG3436dc29239d ) -
since that commit, we've made several enhancements, so the reasoning there is no longer
valid. Specifically, we added a poison value to IR, and we clarified the behavior of
undef/poison elements in a shuffle mask:
https://llvm.org/docs/LangRef.html#shufflevector-instruction

Alive2 seems to agree that the propagation of flags in the test diffs shown here are valid:
https://alive2.llvm.org/ce/z/UuY-jr
https://alive2.llvm.org/ce/z/GXoMD9
https://alive2.llvm.org/ce/z/nVCyVH

Differential Revision: https://reviews.llvm.org/D115526
llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
llvm/test/Transforms/InstCombine/X86/x86-muldq-inseltpoison.ll
llvm/test/Transforms/InstCombine/X86/x86-muldq.ll
llvm/test/Transforms/InstCombine/shuffle_select-inseltpoison.ll
llvm/test/Transforms/InstCombine/shuffle_select.ll
llvm/test/Transforms/InstCombine/vec_demanded_elts-inseltpoison.ll
llvm/test/Transforms/InstCombine/vec_demanded_elts.ll