[LLVMbugs] [Bug 21243] New: InstCombiner::commonIDivTransforms: incorrect transformation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Oct 10 09:35:14 PDT 2014


            Bug ID: 21243
           Summary: InstCombiner::commonIDivTransforms: incorrect
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: nunoplopes at sapo.pt
                CC: llvmbugs at cs.uiuc.edu
    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

%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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141010/e646d6ec/attachment.html>

More information about the llvm-bugs mailing list