[Mlir-commits] [mlir] [mlir][arith] Allow folding all +/- 0 under fastmath nsz (PR #217031)

Jakub Kuderski llvmlistbot at llvm.org
Tue Aug 18 09:48:19 PDT 2026


================
@@ -1318,6 +1321,9 @@ OpFoldResult arith::SubFOp::fold(FoldAdaptor adaptor) {
   // subf(x, +0) -> x
   if (matchPattern(adaptor.getRhs(), m_PosZeroFloat()))
     return getLhs();
+  if (matchPattern(adaptor.getRhs(), m_NegZeroFloat()) &&
----------------
kuhar wrote:

Makes sense; ideally, the arith dialect docs should lay out the semantics instead of us implicitly borrowing from the llvm langref

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


More information about the Mlir-commits mailing list