[InstCombine] fix undef propagation bug with shuffle+binop
authorSanjay Patel <spatel@rotateright.com>
Mon, 3 Dec 2018 21:15:17 +0000 (21:15 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 3 Dec 2018 21:15:17 +0000 (21:15 +0000)
commit8c655150827b5d56772e628994db08441c554097
treea3ba34b619e2947c3ca60da932191d5f064b4e84
parent660f9c943ff34c3e30708e848407961b462c070d
[InstCombine] fix undef propagation bug with shuffle+binop

When we have a shuffle that extends a source vector with undefs
and then do some binop on that, we must make sure that the extra
elements remain undef with that binop if we reverse the order of
the binop and shuffle.

'or' is probably the easiest example to show the bug because
'or C, undef --> -1' (not undef). But there are other
opcode/constant combinations where this is true as shown by
the 'shl' test.

llvm-svn: 348191
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/InstCombine/vec_shuffle.ll