I have a question about canonicalization in Arith Dialect:
I think MLIR can only fold x + (-0.0) into x, as shown in figure below. Why MLIR cannot fold x + (+0.0) into x?
Similarly, why does MLIR only fold x - (+0.0) into x?
Blame layer for the code points to a discussion at ⚙ D118244 [MLIR][arith] More float op folders
Actually I think that
%x + 0.0
can’t be folded to%x
, but%x + -0.0
can!That’s because
-0. + 0. == +0.0
.Seems very relevant to [RFC] FastMath flags support in MLIR (arith dialect) - #2 by jfurtek - MLIR - LLVM Discussion Forums