[PATCH] D58644: [InstCombine] Optimize overflow check base on uadd.with.overflow result (PR40846)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 15:33:10 PST 2019


spatel added a comment.

Probably should not be included in the same patch, but if we're seeing this pattern, then is it likely that we'd also see code that checks the inverse condition (that the overflow did not occur)?

  define i1 @uadd_res_uge_x(i32 %x, i32 %y, i1* %p) {
    %a = tail call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 %x, i32 %y)
    %b = extractvalue { i32, i1 } %a, 1
    store i1 %b, i1* %p, align 1
    %c = extractvalue { i32, i1 } %a, 0
    %d = icmp uge i32 %c, %x
    ret i1 %d
  }


Repository:
  rL LLVM

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

https://reviews.llvm.org/D58644





More information about the llvm-commits mailing list