[Mlir-commits] [mlir] 8e946fe - Revert "[mlir][complex] Convert complex.abs to arith with fastmath flag"

Muhammad Omair Javaid llvmlistbot at llvm.org
Mon Aug 28 14:03:47 PDT 2023


Author: Muhammad Omair Javaid
Date: 2023-08-29T02:01:20+05:00
New Revision: 8e946fec0441e7a4eb4604c806afed20c6930cc4

URL: https://github.com/llvm/llvm-project/commit/8e946fec0441e7a4eb4604c806afed20c6930cc4
DIFF: https://github.com/llvm/llvm-project/commit/8e946fec0441e7a4eb4604c806afed20c6930cc4.diff

LOG: Revert "[mlir][complex] Convert complex.abs to arith with fastmath flag"

This reverts commit 653f77690bb2473ff405ccc681c73217fae8b748.

This breaks lldb-aarch64-windows buildbot.
I have reproduced the issue on x86_64 Windows as well.
https://lab.llvm.org/buildbot/#/builders/219/builds/5130

Added: 
    lldb/unittests/SymbolFile/PDB/Inputs/test-pdb.exe

Modified: 
    mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp
    mlir/test/Conversion/ComplexToStandard/convert-to-standard.mlir

Removed: 
    


################################################################################
diff  --git a/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb.exe b/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb.exe
new file mode 100644
index 00000000000000..3a2c64504ed93c
Binary files /dev/null and b/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb.exe 
diff er

diff  --git a/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp b/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp
index 2bcec4ea10f92c..9c05cadc2f07e0 100644
--- a/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp
+++ b/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp
@@ -35,18 +35,13 @@ struct AbsOpConversion : public OpConversionPattern<complex::AbsOp> {
     auto loc = op.getLoc();
     auto type = op.getType();
 
-    arith::FastMathFlagsAttr fmf = op.getFastMathFlagsAttr();
-
     Value real =
         rewriter.create<complex::ReOp>(loc, type, adaptor.getComplex());
     Value imag =
         rewriter.create<complex::ImOp>(loc, type, adaptor.getComplex());
-    Value realSqr =
-        rewriter.create<arith::MulFOp>(loc, real, real, fmf.getValue());
-    Value imagSqr =
-        rewriter.create<arith::MulFOp>(loc, imag, imag, fmf.getValue());
-    Value sqNorm =
-        rewriter.create<arith::AddFOp>(loc, realSqr, imagSqr, fmf.getValue());
+    Value realSqr = rewriter.create<arith::MulFOp>(loc, real, real);
+    Value imagSqr = rewriter.create<arith::MulFOp>(loc, imag, imag);
+    Value sqNorm = rewriter.create<arith::AddFOp>(loc, realSqr, imagSqr);
 
     rewriter.replaceOpWithNewOp<math::SqrtOp>(op, sqNorm);
     return success();

diff  --git a/mlir/test/Conversion/ComplexToStandard/convert-to-standard.mlir b/mlir/test/Conversion/ComplexToStandard/convert-to-standard.mlir
index bc2ea0dd7a5847..5e8986a4a9a464 100644
--- a/mlir/test/Conversion/ComplexToStandard/convert-to-standard.mlir
+++ b/mlir/test/Conversion/ComplexToStandard/convert-to-standard.mlir
@@ -707,19 +707,3 @@ func.func @complex_angle(%arg: complex<f32>) -> f32 {
 // CHECK: %[[IMAG:.*]] = complex.im %[[ARG]] : complex<f32>
 // CHECK: %[[RESULT:.*]] = math.atan2 %[[IMAG]], %[[REAL]] : f32
 // CHECK: return %[[RESULT]] : f32
-
-// -----
-
-// CHECK-LABEL: func @complex_abs_with_fmf
-// CHECK-SAME: %[[ARG:.*]]: complex<f32>
-func.func @complex_abs_with_fmf(%arg: complex<f32>) -> f32 {
-  %abs = complex.abs %arg fastmath<nnan,contract> : complex<f32>
-  return %abs : f32
-}
-// CHECK: %[[REAL:.*]] = complex.re %[[ARG]] : complex<f32>
-// CHECK: %[[IMAG:.*]] = complex.im %[[ARG]] : complex<f32>
-// CHECK-DAG: %[[REAL_SQ:.*]] = arith.mulf %[[REAL]], %[[REAL]] fastmath<nnan,contract> : f32
-// CHECK-DAG: %[[IMAG_SQ:.*]] = arith.mulf %[[IMAG]], %[[IMAG]] fastmath<nnan,contract> : f32
-// CHECK: %[[SQ_NORM:.*]] = arith.addf %[[REAL_SQ]], %[[IMAG_SQ]] fastmath<nnan,contract> : f32
-// CHECK: %[[NORM:.*]] = math.sqrt %[[SQ_NORM]] : f32
-// CHECK: return %[[NORM]] : f32


        


More information about the Mlir-commits mailing list