[InstCombine] replace shuffle's insertelement operand if inserted scalar is not demanded
authorSanjay Patel <spatel@rotateright.com>
Tue, 10 Dec 2019 15:10:05 +0000 (10:10 -0500)
committerSanjay Patel <spatel@rotateright.com>
Tue, 10 Dec 2019 15:10:05 +0000 (10:10 -0500)
commit396d18aeb6cb4409ed71ff4c331748ce1c530f33
tree4f952ec90098ef0e3d72a877f76a3055ec2506a4
parenta0c558ee4cc0f8cd1d30edac5f4fbdedb18eff21
[InstCombine] replace shuffle's insertelement operand if inserted scalar is not demanded

This pattern is noted as a regression from:
D70246
...where we removed an over-aggressive shuffle simplification.

SimplifyDemandedVectorElts fails to catch this case when the insert has multiple uses,
so I'm proposing to pattern match the minimal sequence directly. This fold does not
conflict with any of our current shuffle undef/poison semantics.

Differential Revision: https://reviews.llvm.org/D71220
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
llvm/test/Transforms/InstCombine/insert-extract-shuffle.ll