Morph GT_MOD to GT_DIV in some cases
authorMike Danes <onemihaid@hotmail.com>
Sun, 13 Nov 2016 14:49:31 +0000 (16:49 +0200)
committerMike Danes <onemihaid@hotmail.com>
Tue, 15 Nov 2016 06:04:21 +0000 (08:04 +0200)
commit8b3f1fa4a3ede03cbc690d336dc74145976a60fe
treea41402573b9d05c0e3623120ce606ffb8f14c890
parentd45da457c03957ba8ffe1337d406b2cac73be839
Morph GT_MOD to GT_DIV in some cases

Doing magic division in morph did have one positive effect. For code like
`x = a / 10; y = a % 10;` some (not all due to an assignment) of the common
code was CSEd.

To preserve this optimization we transform `a % b` to `a - (a / b) * b` if we
know that lowering will do magic division. If a redundant `a / b` exists
then CSE can pick it up.
src/jit/morph.cpp