[InstCombine] canonicalize bitcast after insertelement into undef
authorSanjay Patel <spatel@rotateright.com>
Sun, 10 May 2020 15:37:47 +0000 (11:37 -0400)
committerSanjay Patel <spatel@rotateright.com>
Sun, 10 May 2020 15:37:47 +0000 (11:37 -0400)
commit856cc60bc1ad07b5cba1ab81160c1c3ef8ff4c23
tree79908cb9d0df8dc3c024539247e412c5773a6e0b
parentd02b3aba37d9a18691669392ff26ec28b51741f5
[InstCombine] canonicalize bitcast after insertelement into undef

We have a transform in the opposite direction only for the x86 MMX type,
Other types are not handled either way before this patch.

The motivating case from PR45748:
https://bugs.llvm.org/show_bug.cgi?id=45748
...is the last test diff. In that example, we are triggering an existing
bitcast transform, so we reduce the number of casts, and that should give
us the ideal x86 codegen.

Differential Revision: https://reviews.llvm.org/D79171
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
llvm/test/Transforms/InstCombine/bitcast-vec-canon.ll