[Reassociate] allow or->add with shl operands
authorSanjay Patel <spatel@rotateright.com>
Sun, 7 Feb 2021 14:41:46 +0000 (09:41 -0500)
committerSanjay Patel <spatel@rotateright.com>
Sun, 7 Feb 2021 14:45:19 +0000 (09:45 -0500)
commit6fd91be35444c7c8b7ac0744710b55deba1a61de
tree42d3f8cab116c6c49f45f025252b07cbbbb16284
parente12d8279915c323f3727085ccfd0f2c54ad82bdd
[Reassociate] allow or->add with shl operands

As discussed in:
https://llvm.org/PR49055

We invert instcombine's add->or transform here
because it makes it easier to identify factorization
transforms like the mul in the motivating test.

This extends the logic added with:
https://reviews.llvm.org/rG70472f3
https://reviews.llvm.org/rG93f3d7f

(I intentionally kept the formatting fix in this patch
to provide more context about the calling logic.)
llvm/lib/Transforms/Scalar/Reassociate.cpp
llvm/test/Transforms/PhaseOrdering/X86/pixel-splat.ll
llvm/test/Transforms/Reassociate/add-like-or.ll