Optimize (x/y)*y into x-(x%y) in general. Div and rem are about the same, and
authorNick Lewycky <nicholas@mxc.ca>
Fri, 21 Nov 2008 07:33:58 +0000 (07:33 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Fri, 21 Nov 2008 07:33:58 +0000 (07:33 +0000)
commit0c73079855de925bf08335fe39b0b112f3d9407a
tree551a778e44dbac57cbe75b020b9fa977080e6019
parent41e4a59f2f396519e7026011320760c6d0c179c3
Optimize (x/y)*y into x-(x%y) in general. Div and rem are about the same, and
a subtract is cheaper than a multiply. This generalizes an existing transform.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59800 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/InstructionCombining.cpp
test/Transforms/InstCombine/2008-11-20-DivMulRem.ll [new file with mode: 0644]