[llvm-bugs] [Bug 33165] New: NewGVN miscompiles select undef
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu May 25 02:13:43 PDT 2017
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: unassignedbugs at nondot.org
Reporter: nunoplopes at sapo.pt
CC: davide at freebsd.org, dberlin at dberlin.org,
llvm-bugs at lists.llvm.org, regehr at cs.utah.edu
$ 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170525/448613e2/attachment-0001.html>
More information about the llvm-bugs
mailing list