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

Thomas Raoux llvmlistbot at llvm.org
Wed Oct 1 19:59:27 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)) {
----------------
ThomasRaoux wrote:

doesn't it need also ninf? inf * 0 -> Nan

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


More information about the Mlir-commits mailing list