http://llvm.org/bugs/show_bug.cgi?id=21243

            Bug ID: 21243
           Summary: InstCombiner::commonIDivTransforms: incorrect
                    transformation
           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

One transformation done in InstCombiner::commonIDivTransforms()
(InstCombineMulDivRem.cpp) is incorrect:

(X / C1) / C2  -> 0
if C1*C2 overflows

In the following counterexample, we can see that even C1*C2 overflows (it does,
the result would be = 2), the final result may be non-zero.

----------------------------------------
Pre: !WillNotOverflowSignedMul(C1, C2)
%Op0 = sdiv %X, C1
%r = sdiv %Op0, C2
  =>
%r = 0

Done: 1
ERROR: Mismatch in values of i2 %r

Example:
%X i2 = 2 (0x2)
C1 i2 = 2 (0x2)
C2 i2 = 3 (0x3)
%Op0 i2 = 1 (0x1)
Source value: 3 (0x3)
Target value: 0 (0x0)

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