[Reassociate] Canonicalizing 'x [+-] (-Constant * y)' isn't always a win
authorDavid Majnemer <david.majnemer@gmail.com>
Thu, 28 May 2015 06:16:39 +0000 (06:16 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Thu, 28 May 2015 06:16:39 +0000 (06:16 +0000)
Canonicalizing 'x [+-] (-Constant * y)' is not a win if we don't *know*
we will open up CSE opportunities.

If the multiply was 'nsw', then negating 'y' requires us to clear the
'nsw' flag.  If this is actually worth pursuing, it is probably more
appropriate to do so in GVN or EarlyCSE.

This fixes PR23675.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238397 91177308-0d34-0410-b5e6-96231b3b80d8


No differences found