[PATCH] D138814: [InstCombine] Combine a/lshr of add -> uadd.with.overflow
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 30 05:55:24 PST 2022
spatel added a comment.
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.
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