[PATCH] D69244: [InstCombine] Extra combine for uadd_sat

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 06:54:50 PDT 2019


lebedev.ri added a comment.

@dmgreen if you're interested, there is at least one edge-case pattern:
https://godbolt.org/z/0dICgS

  ----------------------------------------
    %2 = icmp eq i32 %0, 0
    %3 = add i32 %0, -1
    %4 = select i1 %2, i32 0, i32 %3
    ret i32 %4
  =>
    %4 = usub_sat i32 %0, 1
    ret i32 %4
    %3 = add i32 %0, -1
    %2 = icmp eq i32 %0, 0
  
  Done: 1
  Optimization is correct!


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

https://reviews.llvm.org/D69244





More information about the llvm-commits mailing list