[llvm-bugs] [Bug 43731] New: Incorrect instcombine 'and + icmp eq' -> 'icmp ult' fold

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 20 04:36:56 PDT 2019


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

            Bug ID: 43731
           Summary: Incorrect instcombine 'and + icmp eq' -> 'icmp ult'
                    fold
           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

The 2nd element of the result of this test case is incorrect
(InstCombine/canonicalize-constant-low-bit-mask-and-icmp-eq-to-icmp-ule.ll):

define <3 x i1> @p3_vec_splat_undef(<3 x i8> %x) {
  %tmp0 = and <3 x i8> %x, { 3, undef, 3 }
  %ret = icmp eq <3 x i8> %tmp0, %x
  ret <3 x i1> %ret
}
=>
define <3 x i1> @p3_vec_splat_undef(<3 x i8> %x) {
  %1 = icmp ult <3 x i8> %x, { 4, undef, 4 }
  ret <3 x i1> %1
}
Transformation doesn't verify!
ERROR: Value mismatch

Example:
<3 x i8> %x = < #x00 (0), #x00 (0), #x00 (0) >

Source:
<3 x i8> %tmp0 = < #x00 (0), #x00 (0), #x00 (0) >
<3 x i1> %ret = < #x1 (1), #x1 (1), #x1 (1) >

Target:
<3 x i1> %1 = < #x1 (1), #x0 (0), #x1 (1) >
Source value: < #x1 (1), #x1 (1), #x1 (1) >
Target value: < #x1 (1), #x0 (0), #x1 (1) >

-- 
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/20191020/4570e74e/attachment-0001.html>


More information about the llvm-bugs mailing list