Remove an InstCombine that transformed patterns like (x * uitofp i1 y) to (select...
authorOwen Anderson <resistor@mac.com>
Sun, 17 Aug 2014 03:51:29 +0000 (03:51 +0000)
committerOwen Anderson <resistor@mac.com>
Sun, 17 Aug 2014 03:51:29 +0000 (03:51 +0000)
commit7a0201c6a60d95a4afd6434a790526c6217b111f
treef7368b2dd5b3b2253a86dcc7cddb50cb80a9530b
parent48c67ed949a7a59b0dd8737955e6e0b264bf4f91
Remove an InstCombine that transformed patterns like (x * uitofp i1 y) to (select y, x, 0.0) when the multiply has fast math flags set.
While this might seem like an obvious canonicalization, there is one subtle problem with it.  The result of the original expression
is undef when x is NaN (remember, fast math flags), but the result of the select is always defined when x is NaN.  This means that the
new expression is strictly more defined than the original one.  One unfortunate consequence of this is that the transform is not reversible!
It's always legal to make increase the defined-ness of an expression, but it's not legal to reduce it.  Thus, targets that prefer the original
form of the expression cannot reverse the transform to recover it.  Another way to think of it is that the transform has lost source-level
information (the fast math flags), which is undesirable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215825 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
test/Transforms/InstCombine/add4.ll [deleted file]