[Mlir-commits] [mlir] [mlir][complex] Support Fastmath flag in conversion of complex.div to standard (PR #82729)

Mehdi Amini llvmlistbot at llvm.org
Fri Feb 23 00:03:32 PST 2024


================
@@ -206,11 +207,13 @@ struct TrigonometricOpConversion : public OpConversionPattern<TrigonometricOp> {
     // implementation in the subclass to combine them.
     Value half = rewriter.create<arith::ConstantOp>(
         loc, elementType, rewriter.getFloatAttr(elementType, 0.5));
-    Value exp = rewriter.create<math::ExpOp>(loc, imag);
-    Value scaledExp = rewriter.create<arith::MulFOp>(loc, half, exp);
-    Value reciprocalExp = rewriter.create<arith::DivFOp>(loc, half, exp);
-    Value sin = rewriter.create<math::SinOp>(loc, real);
-    Value cos = rewriter.create<math::CosOp>(loc, real);
+    Value exp = rewriter.create<math::ExpOp>(loc, imag, fmf.getValue());
+    Value scaledExp =
+        rewriter.create<arith::MulFOp>(loc, half, exp, fmf.getValue());
+    Value reciprocalExp =
+        rewriter.create<arith::DivFOp>(loc, half, exp, fmf.getValue());
+    Value sin = rewriter.create<math::SinOp>(loc, real, fmf.getValue());
+    Value cos = rewriter.create<math::CosOp>(loc, real, fmf.getValue());
----------------
joker-eph wrote:

Can we avoid the `getValue()` please? You have an attribute and you unpack it: I just expect the end result being that the builder under the hood will recreate the attribute again!

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


More information about the Mlir-commits mailing list