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

Paweł Bylica via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 09:25:22 PST 2022


chfast added a comment.

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

> In D138814#3953729 <https://reviews.llvm.org/D138814#3953729>, @foad wrote:
>
>>> What do you think about producing the sequence with 'not' + 'icmp' instead of the uadd + extract?
>>
>> The point about using uadd.with.overflow is that it also gives you the truncated 32 bit result of the add.
>
> If we're not using that value (as shown in the first two tests), then do we still we want to canonicalize to an overflow intrinsic? That implies that we also need to transform the "not+icmp" pattern into "uadd+extract" to be consistent.

Well, some time ago we added a change that changes usubo without math usage into icmp https://reviews.llvm.org/rG926e7312b2f20f2f7b0a3d5ddbd29da5625507f3. Here this is not so simple as you need two instructions but I wander what direction do we want to go. Previously there were concerns about forming intrinsic before CodeGenPrepare.


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