[InstCombine] try to fold one-demanded-bit-of-multiply
authorSanjay Patel <spatel@rotateright.com>
Fri, 4 Feb 2022 16:24:01 +0000 (11:24 -0500)
committerSanjay Patel <spatel@rotateright.com>
Fri, 4 Feb 2022 16:40:54 +0000 (11:40 -0500)
commit0236c571810dea1b72d99ee0af124a7a09976e00
tree5c29a37eb949c65cc18fb331a034136d8eb4de77
parent1eb4f88bfef1ab93b8286fdfd05a8b814507e329
[InstCombine] try to fold one-demanded-bit-of-multiply

This is a generalization of the icmp fold in D118061 (and that can be abandoned).
We're looking for a disguised form of "odd * odd must be odd".
Some Alive2 proofs to show correctness:
https://alive2.llvm.org/ce/z/60Y8hz
https://alive2.llvm.org/ce/z/HfAP6R

Differential Revision: https://reviews.llvm.org/D118539
llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
llvm/test/Transforms/InstCombine/icmp-mul-and.ll
llvm/test/Transforms/InstCombine/mul-masked-bits.ll