[PATCH] D104932: [instcombine] Fold overflow check using overflow intrinsic to comparison

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 30 08:56:51 PDT 2021


spatel added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/ssubo.ll:59
 
 define i1 @test_constant4(i8 %a) {
 ; CHECK-LABEL: @test_constant4(
----------------
reames wrote:
> spatel wrote:
> > I focused in on this example, and we are missing a fold:
> > https://alive2.llvm.org/ce/z/EfBUXP
> > 
> > Does that hold for all of the overflow ops? Could we produce the optimal icmp directly (no add with constant necessary)?
> Hm, have to give this one some thought.  Would you mind if we did this incrementally?  i.e. land this, then improve?
I had to try to generalize this, and I think I have it:
https://alive2.llvm.org/ce/z/j4TDR_

I'll work on that patch now, so we don't have to worry about regressions for this set of tests at least (not sure if that is enough on its own for all tests).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104932/new/

https://reviews.llvm.org/D104932



More information about the llvm-commits mailing list