[llvm-bugs] [Bug 39861] New: Incorrect fold of 'x & (-1 >> y) s>= x'

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Dec 2 14:47:39 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=39861

            Bug ID: 39861
           Summary: Incorrect fold of 'x & (-1 >> y) s>= x'
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Keywords: miscompilation
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: nunoplopes at sapo.pt
                CC: lebedev.ri at gmail.com, llvm-bugs at lists.llvm.org,
                    regehr at cs.utah.edu, spatel+llvm at rotateright.com

This is a bug in
test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sge-to-icmp-sle.ll

Output of Alive2:
declare i1 @pv(i8 %x, i8 %y) {
  %tmp0 = lshr i8 255, %y
  %tmp1 = and i8 %tmp0, %x
  %ret = icmp sge i8 %tmp1, %x
  ret i1 %ret
}
=>
declare i1 @pv(i8 %x, i8 %y) {
  %tmp0 = lshr i8 255, %y
  %1 = icmp sge i8 %tmp0, %x
  ret i1 %1
}
Transformation doesn't verify!
ERROR: Value mismatch

Example:
i8 %x = 0x7e (126)
i8 %y = 0x0 (0)

Source:
i8 %tmp0 = 0xff (255, -1)
i8 %tmp1 = 0x7e (126)
i1 %ret = 0x1 (1, -1)

Target:
i8 %tmp0 = 0xff (255, -1)
i1 %1 = 0x0 (0)
Source value: 0x1 (1, -1)
Target value: 0x0 (0)

-- 
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/20181202/9b79c639/attachment.html>


More information about the llvm-bugs mailing list