The current code may not always work correctly, e.g.:
https://github.com/llvm/llvm-project/issues/57201
I added 'enable-experimental' pass option so that SUM simplification
may be enabled in LIT tests, but it is not enabled when the pass
is added to the passes pipeline.
Differential Revision: https://reviews.llvm.org/D131640
This function can be inlined by a general purpose inlining pass.
}];
let constructor = "::fir::createSimplifyIntrinsicsPass()";
+
+ let options = [
+ Option<"enableExperimental", "enable-experimental", "bool",
+ /*default=*/"false",
+ "Enable experimental code that may not always work correctly">
+ ];
}
def MemoryAllocationOpt : Pass<"memory-allocation-opt", "mlir::func::FuncOp"> {
// Prototype for runtime call (from sum.cpp):
// RTNAME(Sum<T>)(const Descriptor &x, const char *source, int line,
// int dim, const Descriptor *mask)
- if (funcName.startswith("_FortranASum")) {
+ //
+ // Disable SUM inlining by default, because it fatally fails on some
+ // FIR yet.
+ if (enableExperimental && 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];
-// RUN: fir-opt --split-input-file --simplify-intrinsics %s | FileCheck %s
+// RUN: fir-opt --split-input-file --simplify-intrinsics='enable-experimental=true' %s | FileCheck %s
// Call to SUM with 1D I32 array is replaced.
module attributes {fir.defaultkind = "a1c4d8i4l4r4", fir.kindmap = "", llvm.target_triple = "native"} {