[llvm-bugs] [Bug 38021] New: [ValueTracking] try harder to find 'nuw'

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 2 10:16:19 PDT 2018


            Bug ID: 38021
           Summary: [ValueTracking] try harder to find 'nuw'
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org

As discussed in:
computeOverflowForUnsignedAdd() doesn't have the same level of analysis as
computeOverflowForSignedAdd(), so in this example:

define i8 @no_overflow(i8 %x) {
  %clear_top_3_bits = lshr i8 %x, 3
  %add = add i8 %clear_top_3_bits, 193 ; 0b11000001
  ret i8 %add

...we determine that the add is 'nsw', but not 'nuw':

$ ./opt -instcombine addnuw.ll -S

define i8 @no_overflow(i8 %x) {
  %clear_top_3_bits = lshr i8 %x, 3
  %add = add nsw i8 %clear_top_3_bits, -63
  ret i8 %add


You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180702/59129994/attachment.html>

More information about the llvm-bugs mailing list