[flang-commits] [flang] [flang] Simplify copy-in copy-out runtime API (PR #95822)
via flang-commits
flang-commits at lists.llvm.org
Mon Jun 17 11:12:20 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir
@llvm/pr-subscribers-flang-runtime
Author: None (jeanPerier)
<details>
<summary>Changes</summary>
@<!-- -->klausler for the runtime commit.
The runtime API for copy-in copy-out currently only has an entry only for the copy-out. This entry has a "skipInit" boolean that is never set to false by lowering and it does not deal with the deallocation of the temporary.
Inlined code had to:
- for the copy-in, establish the temporary descriptor and call AssignTemporary
- for the copy-out, call CopyOutAssign and then, sometimes, call DerivedTypeDestroyWithoutFinalization, and then do inline deallocation.
This is not a big deal, but this is unneeded compiler and generated code complexity. With assumed-rank, it is also more cumbersome to establish a temporary descriptor.
Instead, this patch:
- Adds a CopyInAssignment API that deals with establishing the temporary descriptor and does the copy.
- Removes unused arg to CopyOutAssign, and pushes destruction/deallocation responsibility inside it.
Note that this runtime API are still not responsible for deciding the need of copying-in and out. This is kept has a separate runtime call to IsContiguous, which is easier to inline/replace by inline code with the hope of removing the copy-in/out calls after user function inlining. @<!-- -->vzakhari has already shown that always inlining all the copy part increase Fortran compilation time due to loop optimization attempts for loops that are known to have little optimization profitability (the variable being copied from and to is not contiguous).
The second patch updates hlfir.copy_in/hlfir.copy_out operations and lowering. It cannot be in a different patch because the API change is a breaking change for lowering. Tests for the assumed-rank lowering case will be added in another patch however.
---
Patch is 109.46 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/95822.diff
26 Files Affected:
- (modified) flang/include/flang/Optimizer/Builder/Runtime/Assign.h (+5-11)
- (modified) flang/include/flang/Optimizer/Dialect/FIRType.h (+6)
- (modified) flang/include/flang/Optimizer/HLFIR/HLFIROps.td (+12-6)
- (modified) flang/include/flang/Runtime/assign.h (+10-2)
- (modified) flang/lib/Lower/ConvertCall.cpp (+32-25)
- (modified) flang/lib/Lower/ConvertExpr.cpp (+43-45)
- (modified) flang/lib/Optimizer/Builder/Runtime/Assign.cpp (+17-7)
- (modified) flang/lib/Optimizer/Dialect/FIRType.cpp (+20)
- (modified) flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp (+2-2)
- (modified) flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp (+30-54)
- (modified) flang/runtime/assign.cpp (+15-17)
- (modified) flang/test/HLFIR/assumed-type-actual-args.f90 (+18-21)
- (modified) flang/test/HLFIR/assumed_shape_with_value_keyword.f90 (+16-16)
- (modified) flang/test/HLFIR/copy-in-out-codegen.fir (+85-103)
- (modified) flang/test/HLFIR/copy-in-out.fir (+13-12)
- (modified) flang/test/HLFIR/memory-effects.fir (+8-7)
- (modified) flang/test/Lower/HLFIR/call-sequence-associated-descriptors.f90 (+8-8)
- (modified) flang/test/Lower/HLFIR/calls-assumed-shape.f90 (+4-4)
- (modified) flang/test/Lower/HLFIR/calls-constant-expr-arg.f90 (+2-2)
- (modified) flang/test/Lower/HLFIR/calls-optional.f90 (+6-7)
- (modified) flang/test/Lower/HLFIR/calls-poly-to-assumed-type.f90 (+2-2)
- (modified) flang/test/Lower/HLFIR/poly_expr_for_nonpoly_dummy.f90 (+4-4)
- (modified) flang/test/Lower/call-copy-in-out.f90 (+10-14)
- (modified) flang/test/Lower/dummy-argument-assumed-shape-optional.f90 (-6)
- (modified) flang/test/Lower/dummy-argument-optional-2.f90 (+2-8)
- (modified) flang/test/Lower/optional-value-caller.f90 (+6-4)
``````````diff
diff --git a/flang/include/flang/Optimizer/Builder/Runtime/Assign.h b/flang/include/flang/Optimizer/Builder/Runtime/Assign.h
index 14d338b7093e8..52a6a1d8e5a02 100644
--- a/flang/include/flang/Optimizer/Builder/Runtime/Assign.h
+++ b/flang/include/flang/Optimizer/Builder/Runtime/Assign.h
@@ -56,18 +56,12 @@ void genAssignExplicitLengthCharacter(fir::FirOpBuilder &builder,
void genAssignTemporary(fir::FirOpBuilder &builder, mlir::Location loc,
mlir::Value destBox, mlir::Value sourceBox);
-/// Generate runtime call to CopyOutAssign to assign \p sourceBox to
-/// \p destBox. This call implements the copy-out of a temporary
-/// (\p sourceBox) to the actual argument (\p destBox) passed to a procedure,
-/// after the procedure returns to the caller.
-/// If \p skipToInit is false, then \p destBox will be initialized before
-/// the assignment, otherwise, it is assumed to be already initialized.
-/// The runtime makes sure that there is no reallocation of the top-level
-/// entity represented by \p destBox. If reallocation is required
-/// for the components of \p destBox, then it is done without finalization.
+/// Generate runtime call to "CopyInAssign" runtime API.
+void genCopyInAssign(fir::FirOpBuilder &builder, mlir::Location loc,
+ mlir::Value tempBoxAddr, mlir::Value varBoxAddr);
+/// Generate runtime call to "CopyOutAssign" runtime API.
void genCopyOutAssign(fir::FirOpBuilder &builder, mlir::Location loc,
- mlir::Value destBox, mlir::Value sourceBox,
- bool skipToInit);
+ mlir::Value varBoxAddr, mlir::Value tempBoxAddr);
} // namespace fir::runtime
#endif // FORTRAN_OPTIMIZER_BUILDER_RUNTIME_ASSIGN_H
diff --git a/flang/include/flang/Optimizer/Dialect/FIRType.h b/flang/include/flang/Optimizer/Dialect/FIRType.h
index 0aeb29a93d71e..3498a329ced30 100644
--- a/flang/include/flang/Optimizer/Dialect/FIRType.h
+++ b/flang/include/flang/Optimizer/Dialect/FIRType.h
@@ -41,6 +41,9 @@ class BaseBoxType : public mlir::Type {
public:
using mlir::Type::Type;
+ /// Box attributes.
+ enum class Attribute { None, Allocatable, Pointer };
+
/// Returns the element type of this box type.
mlir::Type getEleTy() const;
@@ -55,6 +58,9 @@ class BaseBoxType : public mlir::Type {
BaseBoxType getBoxTypeWithNewShape(mlir::Type shapeMold) const;
BaseBoxType getBoxTypeWithNewShape(int rank) const;
+ /// Return the same type, except for the attribute (fir.heap/fir.ptr).
+ BaseBoxType getBoxTypeWithNewAttr(Attribute attr) const;
+
/// Methods for support type inquiry through isa, cast, and dyn_cast.
static bool classof(mlir::Type type);
};
diff --git a/flang/include/flang/Optimizer/HLFIR/HLFIROps.td b/flang/include/flang/Optimizer/HLFIR/HLFIROps.td
index b537d9e11ef80..e9915e899c2c9 100644
--- a/flang/include/flang/Optimizer/HLFIR/HLFIROps.td
+++ b/flang/include/flang/Optimizer/HLFIR/HLFIROps.td
@@ -1091,9 +1091,12 @@ def hlfir_CopyInOp : hlfir_Op<"copy_in", [MemoryEffects<[MemAlloc]>]> {
potentially absent variable storage. The second result indicates if a copy
was made.
+ A descriptor address must be provided for the temporary. This descriptor will
+ be set if a temporary copy was made.
+
This operation is meant to be used in combination with the hlfir.copy_out
- operation that deletes the temporary if it was created and copies the data
- back if needed.
+ operation that takes the address of the descriptor for the temporary, deletes
+ the temporary if it was created, and copies the data back if needed.
This operation allows passing non contiguous arrays to contiguous dummy
arguments, which is possible in Fortran procedure references.
@@ -1103,17 +1106,19 @@ def hlfir_CopyInOp : hlfir_Op<"copy_in", [MemoryEffects<[MemAlloc]>]> {
}];
let arguments = (ins Arg<fir_BaseBoxType, "", [MemRead]>:$var,
- Optional<I1>:$var_is_present);
+ Arg<AnyReferenceLike, "", [MemWrite]>:$tempBox,
+ Optional<I1>:$var_is_present);
let results = (outs fir_BaseBoxType, I1);
let assemblyFormat = [{
- $var (`handle_optional` $var_is_present^)?
+ $var `to` $tempBox (`handle_optional` $var_is_present^)?
attr-dict `:` functional-type(operands, results)
}];
let builders = [
- OpBuilder<(ins "mlir::Value":$var, "mlir::Value":$var_is_present)>
+ OpBuilder<(ins "mlir::Value":$var, "mlir::Value":$temp_box,
+ "mlir::Value":$var_is_present)>
];
let extraClassDeclaration = [{
@@ -1138,9 +1143,10 @@ def hlfir_CopyOutOp : hlfir_Op<"copy_out", [MemoryEffects<[MemFree]>]> {
the temporary.
The copy back is done if $var is provided and $was_copied is true.
The deallocation of $temp is done if $was_copied is true.
+ $temp must be the descriptor address that was provided to hlfir.copy_in.
}];
- let arguments = (ins Arg<fir_BaseBoxType, "", [MemRead]>:$temp,
+ let arguments = (ins Arg<AnyReferenceLike, "", [MemRead]>:$temp,
I1:$was_copied,
Arg<Optional<fir_BaseBoxType>, "", [MemWrite]>:$var);
diff --git a/flang/include/flang/Runtime/assign.h b/flang/include/flang/Runtime/assign.h
index b19c02f44c73b..a1cc9eaf4355f 100644
--- a/flang/include/flang/Runtime/assign.h
+++ b/flang/include/flang/Runtime/assign.h
@@ -36,8 +36,16 @@ void RTDECL(Assign)(Descriptor &to, const Descriptor &from,
// reallocation.
void RTDECL(AssignTemporary)(Descriptor &to, const Descriptor &from,
const char *sourceFile = nullptr, int sourceLine = 0);
-void RTDECL(CopyOutAssign)(Descriptor &to, const Descriptor &from,
- bool skipToInit, const char *sourceFile = nullptr, int sourceLine = 0);
+
+// Establish "temp" descriptor as an allocatable descriptor with the same type,
+// rank, and length parameters as "var" and copy "var" to it using
+// AssignTemporary.
+void RTDECL(CopyInAssign)(Descriptor &temp, const Descriptor &var,
+ const char *sourceFile = nullptr, int sourceLine = 0);
+// When "var" is provided, copy "temp" to it assuming "var" is already
+// initialized. Destroy and deallocate "temp" in all cases.
+void RTDECL(CopyOutAssign)(Descriptor *var, Descriptor &temp,
+ const char *sourceFile = nullptr, int sourceLine = 0);
// This variant is for assignments to explicit-length CHARACTER left-hand
// sides that might need to handle truncation or blank-fill, and
// must maintain the character length even if an allocatable array
diff --git a/flang/lib/Lower/ConvertCall.cpp b/flang/lib/Lower/ConvertCall.cpp
index b1dc41f3ca838..5b0271679085f 100644
--- a/flang/lib/Lower/ConvertCall.cpp
+++ b/flang/lib/Lower/ConvertCall.cpp
@@ -920,9 +920,11 @@ namespace {
struct CallCleanUp {
struct CopyIn {
void genCleanUp(mlir::Location loc, fir::FirOpBuilder &builder) {
- builder.create<hlfir::CopyOutOp>(loc, copiedIn, wasCopied, copyBackVar);
+ builder.create<hlfir::CopyOutOp>(loc, tempBox, wasCopied, copyBackVar);
}
- mlir::Value copiedIn;
+ // address of the descriptor holding the temp if a temp was created.
+ mlir::Value tempBox;
+ // Boolean indicating if a copy was made or not.
mlir::Value wasCopied;
// copyBackVar may be null if copy back is not needed.
mlir::Value copyBackVar;
@@ -944,10 +946,10 @@ struct CallCleanUp {
/// It holds the value to be passed in the call and any related
/// clean-ups to be done after the call.
struct PreparedDummyArgument {
- void pushCopyInCleanUp(mlir::Value copiedIn, mlir::Value wasCopied,
+ void pushCopyInCleanUp(mlir::Value tempBox, mlir::Value wasCopied,
mlir::Value copyBackVar) {
cleanups.emplace_back(
- CallCleanUp{CallCleanUp::CopyIn{copiedIn, wasCopied, copyBackVar}});
+ CallCleanUp{CallCleanUp::CopyIn{tempBox, wasCopied, copyBackVar}});
}
void pushExprAssociateCleanUp(mlir::Value tempVar, mlir::Value wasCopied) {
cleanups.emplace_back(
@@ -986,7 +988,6 @@ struct ConditionallyPreparedDummy {
for (const CallCleanUp &c : preparedDummy.cleanups) {
if (const auto *copyInCleanUp =
std::get_if<CallCleanUp::CopyIn>(&c.cleanUp)) {
- thenResultValues.push_back(copyInCleanUp->copiedIn);
thenResultValues.push_back(copyInCleanUp->wasCopied);
if (copyInCleanUp->copyBackVar)
thenResultValues.push_back(copyInCleanUp->copyBackVar);
@@ -1041,8 +1042,10 @@ struct ConditionallyPreparedDummy {
mlir::Value copyBackVar;
if (copyInCleanUp->copyBackVar)
copyBackVar = ifOp.getResults().back();
- preparedDummy.pushCopyInCleanUp(ifOp.getResults()[1],
- ifOp.getResults()[2], copyBackVar);
+ // tempBox is an hlfir.copy_in argument created outside of the
+ // fir.if region. It needs not to be threaded as a fir.if result.
+ preparedDummy.pushCopyInCleanUp(copyInCleanUp->tempBox,
+ ifOp.getResults()[1], copyBackVar);
} else {
preparedDummy.pushExprAssociateCleanUp(ifOp.getResults()[1],
ifOp.getResults()[2]);
@@ -1203,10 +1206,29 @@ static PreparedDummyArgument preparePresentUserCallActualArgument(
dummyTypeWithActualRank, actual.getFortranElementType(),
actual.isPolymorphic());
+ PreparedDummyArgument preparedDummy;
+
+ // Helpers to generate hlfir.copy_in operation and register the related
+ // hlfir.copy_out creation.
+ auto genCopyIn = [&](hlfir::Entity var, bool doCopyOut) -> hlfir::Entity {
+ auto baseBoxTy = mlir::dyn_cast<fir::BaseBoxType>(var.getType());
+ assert(baseBoxTy && "expect non simply contiguous variables to be boxes");
+ // Create allocatable descriptor for the potential temporary.
+ mlir::Type tempBoxType = baseBoxTy.getBoxTypeWithNewAttr(
+ fir::BaseBoxType::Attribute::Allocatable);
+ mlir::Value tempBox = builder.createTemporary(loc, tempBoxType);
+ auto copyIn = builder.create<hlfir::CopyInOp>(
+ loc, var, tempBox, /*var_is_present=*/mlir::Value{});
+ // Register the copy-out after the call.
+ preparedDummy.pushCopyInCleanUp(copyIn.getTempBox(), copyIn.getWasCopied(),
+ doCopyOut ? copyIn.getVar()
+ : mlir::Value{});
+ return hlfir::Entity{copyIn.getCopiedIn()};
+ };
+
// Step 2: prepare the storage for the dummy arguments, ensuring that it
// matches the dummy requirements (e.g., must be contiguous or must be
// a temporary).
- PreparedDummyArgument preparedDummy;
hlfir::Entity entity =
hlfir::derefPointersAndAllocatables(loc, builder, actual);
if (entity.isVariable()) {
@@ -1242,8 +1264,6 @@ static PreparedDummyArgument preparePresentUserCallActualArgument(
preparedDummy.pushExprAssociateCleanUp(associate);
} else if (mustDoCopyInOut) {
// Copy-in non contiguous variables.
- assert(mlir::isa<fir::BaseBoxType>(entity.getType()) &&
- "expect non simply contiguous variables to be boxes");
if (actualIsAssumedRank)
TODO(loc, "copy-in and copy-out of assumed-rank arguments");
// TODO: for non-finalizable monomorphic derived type actual
@@ -1253,13 +1273,7 @@ static PreparedDummyArgument preparePresentUserCallActualArgument(
// allocation for the temp in this case. We can communicate
// this to the codegen via some CopyInOp flag.
// This is a performance concern.
- auto copyIn = builder.create<hlfir::CopyInOp>(
- loc, entity, /*var_is_present=*/mlir::Value{});
- entity = hlfir::Entity{copyIn.getCopiedIn()};
- // Register the copy-out after the call.
- preparedDummy.pushCopyInCleanUp(
- copyIn.getCopiedIn(), copyIn.getWasCopied(),
- arg.mayBeModifiedByCall() ? copyIn.getVar() : mlir::Value{});
+ entity = genCopyIn(entity, arg.mayBeModifiedByCall());
}
} else {
const Fortran::lower::SomeExpr *expr = arg.entity->UnwrapExpr();
@@ -1286,14 +1300,7 @@ static PreparedDummyArgument preparePresentUserCallActualArgument(
entity = hlfir::Entity{builder.create<fir::ReboxOp>(
loc, boxType, entity, /*shape=*/mlir::Value{},
/*slice=*/mlir::Value{})};
- auto copyIn = builder.create<hlfir::CopyInOp>(
- loc, entity, /*var_is_present=*/mlir::Value{});
- entity = hlfir::Entity{copyIn.getCopiedIn()};
- // Note that the copy-out is not required, but the copy-in
- // temporary must be deallocated if created.
- preparedDummy.pushCopyInCleanUp(copyIn.getCopiedIn(),
- copyIn.getWasCopied(),
- /*copyBackVar=*/mlir::Value{});
+ entity = genCopyIn(entity, /*doCopyOut=*/false);
}
}
diff --git a/flang/lib/Lower/ConvertExpr.cpp b/flang/lib/Lower/ConvertExpr.cpp
index 9567685aa3d2e..e07256184b97e 100644
--- a/flang/lib/Lower/ConvertExpr.cpp
+++ b/flang/lib/Lower/ConvertExpr.cpp
@@ -2286,11 +2286,21 @@ class ScalarExprLowering {
bool isActualArgBox =
fir::isa_box_type(fir::getBase(copyOutPair.var).getType());
auto doCopyOut = [&]() {
- if (!copyOutPair.argMayBeModifiedByCall) {
- return;
- }
if (!isActualArgBox || inlineCopyInOutForBoxes) {
- genArrayCopy(copyOutPair.var, copyOutPair.temp);
+ if (copyOutPair.argMayBeModifiedByCall)
+ genArrayCopy(copyOutPair.var, copyOutPair.temp);
+ if (mlir::isa<fir::RecordType>(
+ fir::getElementTypeOf(copyOutPair.temp))) {
+ // Destroy components of the temporary (if any).
+ // If there are no components requiring destruction, then the call
+ // is a no-op.
+ mlir::Value tempBox =
+ fir::getBase(builder.createBox(loc, copyOutPair.temp));
+ fir::runtime::genDerivedTypeDestroyWithoutFinalization(builder, loc,
+ tempBox);
+ }
+ // Deallocate the top-level entity of the temporary.
+ builder.create<fir::FreeMemOp>(loc, fir::getBase(copyOutPair.temp));
return;
}
// Generate CopyOutAssign() call to copy data from the temporary
@@ -2301,51 +2311,39 @@ class ScalarExprLowering {
// Moreover, CopyOutAssign() guarantees that there will be no
// finalization for the LHS even if it is of a derived type
// with finalization.
+
+ // Create allocatable descriptor for the temp so that the runtime may
+ // deallocate it.
mlir::Value srcBox =
fir::getBase(builder.createBox(loc, copyOutPair.temp));
- mlir::Value destBox =
- fir::getBase(builder.createBox(loc, copyOutPair.var));
- mlir::Value destBoxRef = builder.createTemporary(loc, destBox.getType());
- builder.create<fir::StoreOp>(loc, destBox, destBoxRef);
- fir::runtime::genCopyOutAssign(builder, loc, destBoxRef, srcBox,
- /*skipToInit=*/true);
- };
- if (!copyOutPair.restrictCopyAndFreeAtRuntime) {
- doCopyOut();
-
- if (mlir::isa<fir::RecordType>(fir::getElementTypeOf(copyOutPair.temp))) {
- // Destroy components of the temporary (if any).
- // If there are no components requiring destruction, then the call
- // is a no-op.
- mlir::Value tempBox =
- fir::getBase(builder.createBox(loc, copyOutPair.temp));
- fir::runtime::genDerivedTypeDestroyWithoutFinalization(builder, loc,
- tempBox);
+ mlir::Type allocBoxTy =
+ mlir::cast<fir::BaseBoxType>(srcBox.getType())
+ .getBoxTypeWithNewAttr(fir::BaseBoxType::Attribute::Allocatable);
+ srcBox = builder.create<fir::ReboxOp>(loc, allocBoxTy, srcBox,
+ /*shift=*/mlir::Value{},
+ /*slice=*/mlir::Value{});
+ mlir::Value srcBoxRef = builder.createTemporary(loc, srcBox.getType());
+ builder.create<fir::StoreOp>(loc, srcBox, srcBoxRef);
+ // Create descriptor pointer to variable descriptor if copy out is needed,
+ // and nullptr otherwise.
+ mlir::Value destBoxRef;
+ if (copyOutPair.argMayBeModifiedByCall) {
+ mlir::Value destBox =
+ fir::getBase(builder.createBox(loc, copyOutPair.var));
+ destBoxRef = builder.createTemporary(loc, destBox.getType());
+ builder.create<fir::StoreOp>(loc, destBox, destBoxRef);
+ } else {
+ destBoxRef = builder.create<fir::ZeroOp>(loc, srcBoxRef.getType());
}
+ fir::runtime::genCopyOutAssign(builder, loc, destBoxRef, srcBoxRef);
+ };
- // Deallocate the top-level entity of the temporary.
- builder.create<fir::FreeMemOp>(loc, fir::getBase(copyOutPair.temp));
- return;
- }
-
- builder.genIfThen(loc, *copyOutPair.restrictCopyAndFreeAtRuntime)
- .genThen([&]() {
- doCopyOut();
- if (mlir::isa<fir::RecordType>(
- fir::getElementTypeOf(copyOutPair.temp))) {
- // Destroy components of the temporary (if any).
- // If there are no components requiring destruction, then the call
- // is a no-op.
- mlir::Value tempBox =
- fir::getBase(builder.createBox(loc, copyOutPair.temp));
- fir::runtime::genDerivedTypeDestroyWithoutFinalization(builder, loc,
- tempBox);
- }
-
- // Deallocate the top-level entity of the temporary.
- builder.create<fir::FreeMemOp>(loc, fir::getBase(copyOutPair.temp));
- })
- .end();
+ if (!copyOutPair.restrictCopyAndFreeAtRuntime)
+ doCopyOut();
+ else
+ builder.genIfThen(loc, *copyOutPair.restrictCopyAndFreeAtRuntime)
+ .genThen([&]() { doCopyOut(); })
+ .end();
}
/// Lower a designator to a variable that may be absent at runtime into an
diff --git a/flang/lib/Optimizer/Builder/Runtime/Assign.cpp b/flang/lib/Optimizer/Builder/Runtime/Assign.cpp
index ad0c2af85cdf3..62f03f7d48665 100644
--- a/flang/lib/Optimizer/Builder/Runtime/Assign.cpp
+++ b/flang/lib/Optimizer/Builder/Runtime/Assign.cpp
@@ -69,19 +69,29 @@ void fir::runtime::genAssignTemporary(fir::FirOpBuilder &builder,
builder.create<fir::CallOp>(loc, func, args);
}
+void fir::runtime::genCopyInAssign(fir::FirOpBuilder &builder,
+ mlir::Location loc, mlir::Value destBox,
+ mlir::Value sourceBox) {
+ auto func = fir::runtime::getRuntimeFunc<mkRTKey(CopyInAssign)>(loc, builder);
+ auto fTy = func.getFunctionType();
+ auto sourceFile = fir::factory::locationToFilename(builder, loc);
+ auto sourceLine =
+ fir::factory::locationToLineNo(builder, loc, fTy.getInput(3));
+ auto args = fir::runtime::createArguments(builder, loc, fTy, destBox,
+ sourceBox, sourceFile, sourceLine);
+ builder.create<fir::CallOp>(loc, func, args);
+}
+
void fir::runtime::genCopyOutAssign(fir::FirOpBuilder &builder,
mlir::Location loc, mlir::Value destBox,
- mlir::Value sourceBox, bool skipToInit) {
+ mlir::Value sourceBox) {
auto func =
fir::runtime::getRuntimeFunc<mkRTKey(CopyOutAssign)>(loc, builder);
auto fTy = func.getFunctionType();
auto sourceFile = fir::factory::locationToFilename(builder, loc);
auto sourceLine =
- fir::factory::locationToLineNo(builder, loc, fTy.getInput(4));
- auto i1Ty = builder.getIntegerType(1);
- auto skipToInitVal = builder.createIntegerConstant(loc, i1Ty, skipToInit);
- auto args =
- fir::runtime::createArguments(builder, loc, fTy, destBox, sourceBox,
- skipToInitVal, sourceFile, sourceLine);
+ fir::factory::locationToLineNo(builder, loc, fTy.getInput(3));
+ auto args = fir::runtime::createArguments(builder, loc, fTy, destBox,
+ sourceBox, sourceFile, sourceLine);
builder.create<fir::CallOp>(loc, func, args);
}
diff --git a/flang/lib/Optimizer/Dialect/FIRType.cpp ...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/95822
More information about the flang-commits
mailing list