[PATCH] D138814: [InstCombine] Combine a/lshr of add -> uadd.with.overflow
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 8 05:44:25 PST 2022
nikic added a comment.
In D138814#3980701 <https://reviews.llvm.org/D138814#3980701>, @Pierre-vh wrote:
> In D138814#3973599 <https://reviews.llvm.org/D138814#3973599>, @nikic wrote:
>
>> FWIW our historical stance has always been that uadd.with.overflow is non-canonical, and the canonical pattern is `a + b < a` (for non-constant `b`). uadd.with.overflow generally has worse optimization support, which is why we only form it during CGP for backend purposes.
>
> Interesting, not sure what other reviewers think?
> Maybe adding a TII hook so targets can enable/disable the combine is a good idea? e.g. something like `allowUAddoCanonicalForm`?
I don't think there's any need for target dependence here. You just need to produce `a + b < a` instead of `extract(uaddo(a, b), 1)`. The uaddo will be formed by the backend.
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