[llvm] [InstCombine] Canonicalize more saturated-add variants (PR #100008)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 11:33:17 PDT 2024


topperc 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.

https://github.com/llvm/llvm-project/pull/100008


More information about the llvm-commits mailing list