[LLVMbugs] [Bug 23922] New: GVN incorrectly propagates exact attribute
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Jun 23 03:25:14 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23922
Bug ID: 23922
Summary: GVN incorrectly propagates exact attribute
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: david.majnemer at gmail.com, llvmbugs at cs.uiuc.edu,
regehr at cs.utah.edu
Classification: Unclassified
$ cat bug.ll
define i2 @func16731728(i2, i1, i4, i2, i1, i4, i2, i1, i4, i2, i1, i4) {
%13 = sdiv exact i2 %0, -2
%14 = sdiv i2 %0, -2
%15 = select i1 %1, i2 %13, i2 %14
ret i2 %15
}
$ opt -gvn -S bug.ll
define i2 @func16731728(i2, i1, i4, i2, i1, i4, i2, i1, i4, i2, i1, i4) {
%13 = sdiv exact i2 %0, -2
ret i2 %13
}
This is wrong if we assume that select only propagates poison/undef through the
dynamically chosen value (which I believe is the current interpretation of how
select works).
$ ./alive.py gvn.opt
----------------------------------------
Optimization: func16731728
Precondition: true
%13 = sdiv exact i2 %0, -2
%14 = sdiv i2 %0, -2
%15 = select i1 %1, i2 %13, i2 %14
=>
%15 = sdiv exact i2 %0, -2
ERROR: Domain of undefinedness of Target is smaller than Source's for i2 %15
Example:
%0 i2 = 0x3 (3, -1)
%1 i1 = 0x0 (0)
%13 i2 = 0x0 (0)
%14 i2 = 0x0 (0)
Source value: 0x0 (0)
Target value: undef
--
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/20150623/252ac4d1/attachment.html>
More information about the llvm-bugs
mailing list