[flang-commits] [flang] 5653884 - [FLANG]Remove experimental flag from SUM simplification

Mats Petersson via flang-commits flang-commits at lists.llvm.org
Thu Aug 25 06:12:02 PDT 2022


Author: Mats Petersson
Date: 2022-08-25T14:11:41+01:00
New Revision: 5653884e34e05ee7aad099cc7f729688d92a002f

URL: https://github.com/llvm/llvm-project/commit/5653884e34e05ee7aad099cc7f729688d92a002f
DIFF: https://github.com/llvm/llvm-project/commit/5653884e34e05ee7aad099cc7f729688d92a002f.diff

LOG: [FLANG]Remove experimental flag from SUM simplification

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

Added: 
    flang/test/Transforms/experimental.fir

Modified: 
    flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp
    flang/test/Transforms/simplifyintrinsics.fir

Removed: 
    


################################################################################
diff  --git a/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp b/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp
index 54f1273da38d2..9a9e06665b5b0 100644
--- a/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp
+++ b/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp
@@ -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
index 0000000000000..060e348d9d936
--- /dev/null
+++ b/flang/test/Transforms/experimental.fir
@@ -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:         }

diff  --git a/flang/test/Transforms/simplifyintrinsics.fir b/flang/test/Transforms/simplifyintrinsics.fir
index a0c43efa8a7f1..0d652878f6524 100644
--- a/flang/test/Transforms/simplifyintrinsics.fir
+++ b/flang/test/Transforms/simplifyintrinsics.fir
@@ -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"} {


        


More information about the flang-commits mailing list