[PATCH] D138814: [InstCombine] Combine a/lshr of add -> uadd.with.overflow

Pierre van Houtryve via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 30 06:10:58 PST 2022


Pierre-vh marked an inline comment as done.
Pierre-vh added a comment.

In D138814#3960221 <https://reviews.llvm.org/D138814#3960221>, @spatel wrote:

> In D138814#3959942 <https://reviews.llvm.org/D138814#3959942>, @foad wrote:
>
>> I don't think there is any requirement for the wider type to be exactly double the narrower type.
>
> That's correct:
> https://alive2.llvm.org/ce/z/iLVIgn
>
> So this patch/tests are too narrow as-is. It should be checking something like "if we only demand the top N bits of an add, and the add operands are known zero in those top N bits, then fold the add into an overflow check."
>
> Also, canonicalizing to the add intrinsic if we're not using the add part of the result seems like the wrong direction. I can't tell from the larger test what we're expecting to happen. Please pre-commit the baseline tests, so we can see the diffs.

Will update the combine & add a base test diff.

Do you mean we shouldn't do the combine if the Add has only one use?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138814



More information about the llvm-commits mailing list