[FLANG]Remove experimental flag from SUM simplification
authorMats Petersson <mats.petersson@arm.com>
Wed, 24 Aug 2022 14:43:00 +0000 (15:43 +0100)
committerMats Petersson <mats.petersson@arm.com>
Thu, 25 Aug 2022 13:11:41 +0000 (14:11 +0100)
The SUM function does appear to be safe to use, so remove the
experimental flag for the SUM operation.

Reviewed By: vzakhari, awarzynski

Differential Revision: https://reviews.llvm.org/D132567

flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp
flang/test/Transforms/experimental.fir [new file with mode: 0644]
flang/test/Transforms/simplifyintrinsics.fir

index 54f1273..9a9e066 100644 (file)
@@ -444,9 +444,7 @@ void SimplifyIntrinsicsPass::runOnOperation() {
         // RTNAME(Sum<T>)(const Descriptor &x, const char *source, int line,
         //                int dim, const Descriptor *mask)
         //
-        // Disable SUM inlining by default, because it fatally fails on some
-        // FIR yet.
-        if (enableExperimental && funcName.startswith("_FortranASum")) {
+        if (funcName.startswith("_FortranASum")) {
           mlir::Operation::operand_range args = call.getArgs();
           // args[1] and args[2] are source filename and line number, ignored.
           const mlir::Value &dim = args[3];
diff --git a/flang/test/Transforms/experimental.fir b/flang/test/Transforms/experimental.fir
new file mode 100644 (file)
index 0000000..060e348
--- /dev/null
@@ -0,0 +1,13 @@
+// RUN: fir-opt --split-input-file --simplify-intrinsics='enable-experimental=true' %s | FileCheck %s
+
+// check that a simple function compiled with experimental enabled
+module attributes {fir.defaultkind = "a1c4d8i4l4r4", fir.kindmap = "", llvm.target_triple = "native"} {
+  func.func @experimental_1(%arg0: !fir.ref<i32> {fir.bindc_name = "a"}) -> i32 {
+    %c10 = arith.constant 10 : i32
+    return %c10 : i32
+  }
+}
+
+// CHECK-LABEL:   func.func @experimental_1(
+// CHECK:           return %{{.*}} : i32
+// CHECK:         }
index a0c43ef..0d65287 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: fir-opt --split-input-file --simplify-intrinsics='enable-experimental=true' %s | FileCheck %s
+// RUN: fir-opt --split-input-file --simplify-intrinsics %s | FileCheck %s
 
 // Call to SUM with 1D I32 array is replaced.
 module attributes {fir.defaultkind = "a1c4d8i4l4r4", fir.kindmap = "", llvm.target_triple = "native"} {