[Mlir-commits] [mlir] [mlir][arith] Add mulf(x, 0) -> 0 to mulf folder (PR #161395)

Jakub Kuderski llvmlistbot at llvm.org
Thu Oct 2 04:26:16 PDT 2025


================
@@ -1282,6 +1282,13 @@ OpFoldResult arith::MulFOp::fold(FoldAdaptor adaptor) {
   if (matchPattern(adaptor.getRhs(), m_OneFloat()))
     return getLhs();
 
+  if (arith::bitEnumContainsAll(getFastmath(), arith::FastMathFlags::nnan |
+                                                   arith::FastMathFlags::nsz)) {
----------------
kuhar wrote:

I think it's because nnan applies to the result as well:
> nnan
> No NaNs - Allow optimizations to assume the arguments and result are not NaN. If an argument is a nan

https://github.com/llvm/llvm-project/pull/161395


More information about the Mlir-commits mailing list