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

            Bug ID: 33165
           Summary: NewGVN miscompiles select 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]

$ cat a.ll
define i2 @f(i2, i1) {
  %a = xor i2 %0, -1
  %b = select i1 %1, i2 %a, i2 undef
  %c = and i2 %a, %b
  ret i2 %c
}

$ opt -S a.ll -newgvn
define i2 @f(i2, i1) {
  %a = xor i2 %0, -1
  %b = select i1 %1, i2 %a, i2 undef
  ret i2 %b
}

This is incorrect. Alive report:

ERROR: Mismatch in values of i2 ret_

Example:
%0 i2 = 0x2 (2, -2)
%1 i1 = 0x0 (0)
%a i2 = 0x1 (1)
%b i2 = 0x0 (0)
%c i2 = 0x0 (0)
Source value: 0x0 (0)
Target value: 0x2 (2, -2)

http://rise4fun.com/Alive/dKH


GVN gets this right (http://rise4fun.com/Alive/n6D):
$ opt -S a.ll -gvn
define i2 @f(i2, i1) {
  %a = xor i2 %0, -1
  ret i2 %a
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to