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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to