[Reassociate] prevent partial undef negation replacement
authorSanjay Patel <spatel@rotateright.com>
Mon, 12 Sep 2022 16:03:21 +0000 (12:03 -0400)
committerSanjay Patel <spatel@rotateright.com>
Mon, 12 Sep 2022 16:28:34 +0000 (12:28 -0400)
commit4ca25c66d41ab136d1587b33571d3e58cd5989f8
tree06e3bf3918cb88c3805eff85557be851939a95ba
parenteb2ac0a3c98d118600a7bd37adf376c3e4feacf9
[Reassociate] prevent partial undef negation replacement

As shown in the examples in issue #57683, we allow matching
vectors with poison (undef) in this transform (and possibly more),
but we can't then use the partially defined value as a replacement
value in other expressions blindly.

This seems to be avoided in simpler examples of reassociation,
and other passes should be able to clean up the redundant op
seen in these tests.
llvm/lib/Transforms/Scalar/Reassociate.cpp
llvm/test/Transforms/Reassociate/negation.ll