InstCombine: Flip the order of two urem transforms
authorDavid Majnemer <david.majnemer@gmail.com>
Sun, 12 May 2013 00:07:05 +0000 (00:07 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sun, 12 May 2013 00:07:05 +0000 (00:07 +0000)
commitfa49d7d6e4384381e4307a0d2495e6e5b15821e3
treefbab3795f1f20e90c81c010d2a598576d73ed6f0
parent9b5d70f07630f99f1ec5589aeaba96c6d8ab0aee
InstCombine: Flip the order of two urem transforms

There are two transforms in visitUrem that conflict with each other.

*) One, if a divisor is a power of two, subtracts one from the divisor
   and turns it into a bitwise-and.
*) The other unwraps both operands if they are surrounded by zext
   instructions.

Flipping the order allows the subtraction to go beneath the sign
extension.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181668 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
test/Transforms/InstCombine/rem.ll