InstCombine, InstSimplify: (%X /s C1) /s C2 isn't always 0 when C1 * C2 overflow
authorDavid Majnemer <david.majnemer@gmail.com>
Sat, 11 Oct 2014 10:20:01 +0000 (10:20 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sat, 11 Oct 2014 10:20:01 +0000 (10:20 +0000)
commit9043f74acb70f48b6bb7717cf0e1b39ac259ac1b
tree11a5ec24b820611f99808e4cb24d489845897992
parent2af441e26e010e6c4b935d94f03fc8487e75f4b4
InstCombine, InstSimplify: (%X /s C1) /s C2 isn't always 0 when C1 * C2 overflow

consider:
C1 = INT_MIN
C2 = -1

C1 * C2 overflows without a doubt but consider the following:
%x = i32 INT_MIN

This means that (%X /s C1) is 1 and (%X /s C1) /s C2 is -1.

N. B.  Move the unsigned version of this transform to InstSimplify, it
doesn't create any new instructions.

This fixes PR21243.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219567 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/InstructionSimplify.cpp
lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll [deleted file]
test/Transforms/InstSimplify/exact-nsw-nuw.ll