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

            Bug ID: 23635
           Summary: Instcombine wrongly preserves mul nsw
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

$ cat a.ll
define i2 @func34669005(i2, i1, i4, i2, i1, i4, i2, i1, i4, i2, i1, i4) {
  %13 = mul nsw i2 %0, %3
  %14 = mul nsw i2 %6, %0
  %15 = sub nuw nsw i2 %13, %14
  ret i2 %15
}


$ opt.exe -instcombine -S a.ll
define i2 @func34669005(i2, i1, i4, i2, i1, i4, i2, i1, i4, i2, i1, i4) {
  %13 = sub i2 %3, %6
  %14 = mul nsw i2 %13, %0
  ret i2 %14
}


$ ./alive.py a.opt
----------------------------------------
  %13 = mul nsw i2 %0, %3
  %14 = mul nsw i2 %6, %0
  %15 = sub nuw nsw i2 %13, %14
  ret i2 %15
=>
  %p13 = sub i2 %3, %6
  %p14 = mul nsw i2 %p13, %0
  ret i2 %p14


ERROR: Domain of poisoness of Target is smaller than Source's for i2 ret_

Example:
%0 i2 = 0x3 (3, -1)
%3 i2 = 0x1 (1)
%6 i2 = 0x3 (3, -1)
%13 i2 = 0x3 (3, -1)
%14 i2 = 0x1 (1)
%15 i2 = 0x2 (2, -2)
%p13 i2 = 0x2 (2, -2)
%p14 i2 = 0x2 (2, -2)
Source value: 0x2 (2, -2)
Target value: poison

-- 
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

Reply via email to