[llvm] [InstCombine] Canonicalize more saturated-add variants (PR #100008)
Rose Silicon via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 30 11:39:28 PDT 2024
RSilicon wrote:
> > > > @topperc Do you have any objections to this PR as it is of now?
> >
> >
> > >
> >
> >
> > > Remove the nuw handling unless you can show a real world test that benefits from it. We don't have to solve every possible case in InstCombine.
> >
> >
> > X > -C ? -1 : X + C is the canonicalization of the literal definition of sat.add.
> > X + C has to be nuw for this to work.
> > X >= -C + 1 is basically a weird version of this.
>
> Write a C function that generates IR with nuw on the add.
<img width="1371" alt="Screenshot 2024-07-30 at 2 39 05 PM" src="https://github.com/user-attachments/assets/fce8b5c4-4b3b-4d75-9275-062a0d79ba12">
https://github.com/llvm/llvm-project/pull/100008
More information about the llvm-commits
mailing list