[PATCH] D118539: [InstCombine] try to fold one-demanded-bit-of-multiply

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 30 05:07:14 PST 2022


spatel added a comment.

In D118539#3281913 <https://reviews.llvm.org/D118539#3281913>, @spatel wrote:

> In D118539#3281894 <https://reviews.llvm.org/D118539#3281894>, @RKSimon wrote:
>
>> I don't suppose this can handle D117995 <https://reviews.llvm.org/D117995>? If we can do this in SimplifyDemandedBits then we can add the knownbits fold with the additional NeverUndefOrPoison check.
>>
>> Otherwise I think I'll just add a (DemandedMask ==2 && X == Y) -> 0 special case.
>
> Hmm, not sure if I understood the question. I'm not seeing how we'd do it other than a special-case here. The knownbits fold isn't going to work in general because of the potential undef input?

Also, if we're adding the `Mask==2` special-case for self-multiply, we could add the `Mask==1` case as well:
https://alive2.llvm.org/ce/z/3HcD76


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118539/new/

https://reviews.llvm.org/D118539



More information about the llvm-commits mailing list