https://llvm.org/bugs/show_bug.cgi?id=23926
Bug ID: 23926
Summary: Reassociate wrongly preserves nuw
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]
Classification: Unclassified
$ cat bug.ll
define i2 @func78000101(i2, i2) {
%3 = add nuw i2 %0, 1
%4 = sub nuw nsw i2 %1, %3
ret i2 %4
}
$ opt -reassociate -S bug.ll
define i2 @func78000101(i2, i2) {
%.neg = sub i2 0, %0
%.neg1 = add nuw i2 %.neg, -1
%3 = add i2 %.neg1, %1
ret i2 %3
}
$ ./alive.py bug.opt
----------------------------------------
Optimization: func78000101
Precondition: true
%3 = add nuw i2 %0, 1
%4 = sub nuw nsw i2 %1, %3
ret i2 %4
=>
%.neg = sub i2 0, %0
%.neg1 = add nuw i2 %.neg, -1
%3 = add i2 %.neg1, %1
ret i2 %3
ERROR: Domain of undefinedness of Target is smaller than Source's for i2 %3
Example:
%0 i2 = 0x2 (2, -2)
%1 i2 = 0x0 (0)
%.neg i2 = 0x2 (2, -2)
%.neg1 i2 = 0x1 (1)
Undef inputs: %1
Source value: 0x3 (3, -1)
Target value: undef
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs