Optimizing (a * 0 + b) to (b) requires assuming that a is finite and not
NaN. DAGCombiner will do this optimization when the reassoc fast math
flag is set, which is not correct. Change DAGCombiner to only consider
UnsafeMath for this optimization.
Co-authored-by: Andrea Faulds <andrea.faulds@arm.com>
We are slowly trying to get away from using the global settings by replacing those checks with fast-math-flags. Can we do that here?
This should match the conditions that we use to simplify X * 0.0. That's done via DAG.simplifyFPBinop():