[llvm-bugs] [Bug 43188] New: Incorrect fold of uadd.with.overflow with undef

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Sep 1 04:09:33 PDT 2019


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

            Bug ID: 43188
           Summary: Incorrect fold of uadd.with.overflow with undef
           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,
                    nikita.ppv at gmail.com, regehr at cs.utah.edu

Alive2 complains about a transformation in
Transforms/ConstProp/overflow-ops.ll:

define {i8, i1} @uadd_undef() {
%0:
  %t = uadd_overflow i8 142, undef
  ret {i8, i1} %t
}
=>
define {i8, i1} @uadd_undef() {
%0:
  ret {i8, i1} undef
}
Transformation doesn't verify!
ERROR: Value mismatch

Example:

Source:
{i8, i1} %t = { #x8e (142, -114), #x0 (0) }     [based on undef value]

Target:
Source value: { #x8e (142, -114), #x0 (0) }     [based on undef value]
Target value: { #x00 (0), #x0 (0) }


In summary, there's no value in the source that the undef can take that allows
uadd to return {0, 0}. To return 0, it has to overflow (unsigned), and hence
the 2nd value would be 1.
Two valid return values I can think off: {%a, 0}; {undef, 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/20190901/1f4b9033/attachment.html>


More information about the llvm-bugs mailing list