llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-flang-fir-hlfir Author: jeanPerier <details> <summary>Changes</summary> Scalar hlfir.expr are currently never given hlfir.destroy and are always lowered as alloca, even when those alloca have dynamic length that pins them into unstructured control flow loops not surrounded by stack save/restore, leading to potential stack to grow on each iteration and to potential stack overflow. Emit hlfir.destroy for them, add an explicit cleanup region to hlfir.yield_element, and preserve both through array constructor lowering, elemental inlining, WHERE lowering and bufferization, which now allocates these buffers with fir.allocmem. When such an allocation cannot be hoisted out of the loop, reclaim its stack space with one stacksave/stackrestore pair per block. Allocation placement then keeps these temporaries on the stack in every mode (except under -fdynamic-heap-array which matches the current behavior). Note: an alternative would be to have the stack to heap promotion always promote allocation that it finds inside CFG cycles without stack save/restore to heap, but the final IR is less clean than using destroy because it fallback to some indirect pointer bookkeeping at the function level. Also, it seems to me that the contract of hlfir.expr so far is that they should have matching hlfir.destroy, so it seems cleaner to align character. Please feel free to disagree. Assisted-by: AI --- Patch is 223.25 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/239312.diff 57 Files Affected: - (modified) flang/include/flang/Optimizer/Builder/Character.h (+15-9) - (modified) flang/include/flang/Optimizer/Builder/HLFIRTools.h (+13-4) - (modified) flang/include/flang/Optimizer/HLFIR/HLFIROps.td (+18-8) - (modified) flang/include/flang/Optimizer/Support/AllocationPolicy.h (+7-1) - (modified) flang/lib/Lower/ConvertArrayConstructor.cpp (+5-26) - (modified) flang/lib/Lower/ConvertCall.cpp (+20-9) - (modified) flang/lib/Lower/ConvertExprToHLFIR.cpp (+136-102) - (modified) flang/lib/Optimizer/Builder/CMakeLists.txt (+1) - (modified) flang/lib/Optimizer/Builder/Character.cpp (+18-15) - (modified) flang/lib/Optimizer/Builder/HLFIRTools.cpp (+83-31) - (modified) flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp (+4) - (modified) flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp (+51-24) - (modified) flang/lib/Optimizer/HLFIR/Transforms/InlineElementals.cpp (+33) - (modified) flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp (+26-9) - (modified) flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp (+8-1) - (modified) flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp (+23-17) - (modified) flang/lib/Optimizer/Support/AllocationPolicy.cpp (+13) - (modified) flang/lib/Optimizer/Transforms/AllocationPlacement.cpp (+16-4) - (modified) flang/lib/Optimizer/Transforms/StackArrays.cpp (+47-37) - (modified) flang/lib/Optimizer/Transforms/StackArrays.h (+11-7) - (modified) flang/test/Fir/allocation-placement-pipeline.fir (+27-2) - (modified) flang/test/HLFIR/as_expr-codegen.fir (+6-3) - (modified) flang/test/HLFIR/associate-codegen.fir (+18-8) - (modified) flang/test/HLFIR/bufferize-conditional.fir (+18-8) - (modified) flang/test/HLFIR/bufferize01.fir (+3-1) - (modified) flang/test/HLFIR/char_extremum-bufferization.fir (+46-30) - (added) flang/test/HLFIR/character-expression-lifetimes.fir (+36) - (modified) flang/test/HLFIR/concat-bufferization.fir (+27-15) - (modified) flang/test/HLFIR/destroy-codegen.fir (+4-3) - (modified) flang/test/HLFIR/element-codegen-issue-118922.fir (+3-1) - (modified) flang/test/HLFIR/elemental-codegen.fir (+19-8) - (modified) flang/test/HLFIR/elemental-shallow-copy.fir (+7-2) - (modified) flang/test/HLFIR/elemental.fir (+12-4) - (modified) flang/test/HLFIR/get_length_codegen.fir (+1-1) - (added) flang/test/HLFIR/inline-elemental-cleanup-cfg.fir (+132) - (modified) flang/test/HLFIR/inline-elemental.fir (+30) - (modified) flang/test/HLFIR/no_reassoc-codegen.fir (+4-1) - (added) flang/test/HLFIR/order_assignments/where-element-cleanup.fir (+53) - (modified) flang/test/HLFIR/set_length-codegen.fir (+6-3) - (modified) flang/test/HLFIR/simplify-hlfir-intrinsics-eoshift.fir (+3-1) - (modified) flang/test/Lower/HLFIR/array-ctor-as-elemental-nested.f90 (+2-1) - (modified) flang/test/Lower/HLFIR/array-ctor-as-elemental.f90 (+8-12) - (added) flang/test/Lower/HLFIR/character-expression-cleanup.f90 (+50) - (modified) flang/test/Lower/HLFIR/charconvert.f90 (+10-7) - (modified) flang/test/Lower/HLFIR/elemental-call-vector-subscripts.f90 (+85) - (modified) flang/test/Lower/HLFIR/implicit-type-conversion-allocatable.f90 (+2-1) - (modified) flang/test/Lower/achar.f90 (+2-1) - (modified) flang/test/Lower/array-elemental-calls-2.f90 (+4-2) - (modified) flang/test/Lower/array-elemental-calls-char-byval.f90 (+10-5) - (modified) flang/test/Lower/array-elemental-calls-char-dynamic.f90 (+11-5) - (modified) flang/test/Lower/array-elemental-calls-char.f90 (+4-2) - (modified) flang/test/Lower/charconvert.f90 (+5-5) - (added) flang/test/Transforms/character-expression-storage.f90 (+142) - (added) flang/test/Transforms/character-temporary-placement.fir (+86) - (added) flang/test/Transforms/stack-arrays-block-lifetime.fir (+105) - (added) flang/test/Transforms/stack-arrays-crossing-lifetimes.fir (+33) - (modified) flang/test/Transforms/stack-arrays.fir (+3-3) ``````````diff diff --git a/flang/include/flang/Optimizer/Builder/Character.h b/flang/include/flang/Optimizer/Builder/Character.h index 658118eddcc909..613cb80e5ba9b5 100644 --- a/flang/include/flang/Optimizer/Builder/Character.h +++ b/flang/include/flang/Optimizer/Builder/Character.h @@ -63,13 +63,15 @@ class CharacterExprHelper { void createAssign(const fir::ExtendedValue &lhs, const fir::ExtendedValue &rhs); - /// Create lhs // rhs in temp obtained with fir.alloca + /// Create lhs // rhs in a stack or heap temporary. fir::CharBoxValue createConcatenate(const fir::CharBoxValue &lhs, - const fir::CharBoxValue &rhs); + const fir::CharBoxValue &rhs, + bool useHeap = false); - /// Create {max,min}(lhs,rhs) in temp obtained with fir.alloca - fir::CharBoxValue - createCharExtremum(bool predIsMin, llvm::ArrayRef<fir::CharBoxValue> opCBVs); + /// Create {max,min}(lhs,rhs) in a stack or heap temporary. + fir::CharBoxValue createCharExtremum(bool predIsMin, + llvm::ArrayRef<fir::CharBoxValue> opCBVs, + bool useHeap = false); /// LEN_TRIM intrinsic. mlir::Value createLenTrim(const fir::CharBoxValue &str); @@ -93,8 +95,10 @@ class CharacterExprHelper { std::pair<mlir::Value, mlir::Value> createUnboxChar(mlir::Value boxChar); /// Allocate a temp of fir::CharacterType type and length len. - /// Returns related fir.ref<fir.array<? x fir.char<kind>>>. - fir::CharBoxValue createCharacterTemp(mlir::Type type, mlir::Value len); + /// Use heap storage when useHeap is true. The caller must then free the + /// returned temporary. + fir::CharBoxValue createCharacterTemp(mlir::Type type, mlir::Value len, + bool useHeap = false); /// Allocate a temp of compile time constant length. /// Returns related fir.ref<fir.array<len x fir.char<kind>>>. @@ -235,10 +239,12 @@ std::pair<mlir::Value, mlir::Value> extractCharacterProcedureTuple(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value tuple, bool openBoxProc = true); +/// Convert into a temporary, using heap storage when useHeap is true. The +/// caller must free the result when heap storage is requested. fir::CharBoxValue convertCharacterKind(fir::FirOpBuilder &builder, mlir::Location loc, - fir::CharBoxValue srcBoxChar, - int toKind); + fir::CharBoxValue srcBoxChar, int toKind, + bool useHeap = false); } // namespace fir::factory diff --git a/flang/include/flang/Optimizer/Builder/HLFIRTools.h b/flang/include/flang/Optimizer/Builder/HLFIRTools.h index ce99a370526213..6c5361bc3096c2 100644 --- a/flang/include/flang/Optimizer/Builder/HLFIRTools.h +++ b/flang/include/flang/Optimizer/Builder/HLFIRTools.h @@ -358,10 +358,13 @@ mlir::Type getVariableElementType(hlfir::Entity variable); /// type (that may be an hlfir.expr type). mlir::Type getEntityElementType(hlfir::Entity entity); -using ElementalKernelGenerator = std::function<hlfir::Entity( +using ElementalKernelResult = + std::pair<hlfir::Entity, std::optional<hlfir::CleanupFunction>>; +using ElementalKernelGenerator = std::function<ElementalKernelResult( mlir::Location, fir::FirOpBuilder &, mlir::ValueRange)>; /// Generate an hlfir.elementalOp given call back to generate the element -/// value at for each iteration. +/// value for each iteration and its explicit cleanup, if any. The cleanup +/// callback is emitted in the yield_element cleanup region. /// If exprType is specified, this will be the return type of the elemental op. /// If exprType is not specified, the resulting expression type is computed /// from the given \p elementType and \p shape, and the type is polymorphic @@ -432,7 +435,8 @@ llvm::SmallVector<mlir::Value> genLoopNestWithReductions( /// Inline the body of an hlfir.elemental at the current insertion point /// given a list of one based indices. This generates the computation /// of one element of the elemental expression. Return the YieldElementOp -/// whose value argument is the element value. +/// whose value argument is the element value. The caller must emit or transfer +/// its cleanup region after consuming that value, then erase the yield. /// The original hlfir::ElementalOp is left untouched. hlfir::YieldElementOp inlineElementalOp(mlir::Location loc, fir::FirOpBuilder &builder, @@ -446,11 +450,16 @@ hlfir::YieldElementOp inlineElementalOp(mlir::Location loc, /// current context and uses values that have been cloned already. A callback is /// provided to indicate if an hlfir.apply inside the hlfir.elemental must be /// immediately replaced by the inlining of the applied hlfir.elemental. +/// Collect callbacks for the cloned yield_element cleanup regions, preserving +/// the mapping for each inlined instance. The caller must execute the callbacks +/// in reverse order after consuming the result. An elemental_addr's own cleanup +/// remains the caller's responsibility. mlir::Value inlineElementalOp( mlir::Location loc, fir::FirOpBuilder &builder, hlfir::ElementalOpInterface elemental, mlir::ValueRange oneBasedIndices, mlir::IRMapping &mapper, - const std::function<bool(hlfir::ElementalOp)> &mustRecursivelyInline); + const std::function<bool(hlfir::ElementalOp)> &mustRecursivelyInline, + llvm::SmallVectorImpl<hlfir::CleanupFunction> &cleanups); /// Generate an element-by-element assignment from \p rhs to \p lhs for arrays /// that are known not to alias. The assignment is performed using a loop nest diff --git a/flang/include/flang/Optimizer/HLFIR/HLFIROps.td b/flang/include/flang/Optimizer/HLFIR/HLFIROps.td index 16cf30ffcf0ebc..7b685bfda398ba 100644 --- a/flang/include/flang/Optimizer/HLFIR/HLFIROps.td +++ b/flang/include/flang/Optimizer/HLFIR/HLFIROps.td @@ -1128,7 +1128,7 @@ def hlfir_ElementalOp : hlfir_Op<"elemental", mlir::Region& getElementalRegion() { return getRegion(); } mlir::Value getElementEntity(); - mlir::Region* getElementCleanup() { return nullptr; } + mlir::Region* getElementCleanup(); /// Must this elemental be evaluated in order? bool isOrdered() { return !getUnordered(); } @@ -1145,17 +1145,28 @@ def hlfir_ElementalOp : hlfir_Op<"elemental", let hasVerifier = 1; } -def hlfir_YieldElementOp : hlfir_Op<"yield_element", [Terminator, HasParent<"ElementalOp">, Pure]> { +def hlfir_YieldElementOp : hlfir_Op<"yield_element", [Terminator, + HasParent<"ElementalOp">, + SingleBlockImplicitTerminator<"fir::FirEndOp">, + RecursiveMemoryEffects]> { let summary = "Yield the elemental value in an ElementalOp"; let description = [{ Yield the element value of the current elemental expression iteration in an hlfir.elemental region. See hlfir.elemental description for an - example. + example. The optional cleanup region is executed after the element value + has been consumed. It explicitly describes the cleanup of temporaries + created by this iteration, including the yielded expression itself. There + is no implicit destruction of the yielded value. + + When an elemental is inlined, this cleanup must follow the consumption of + its scalar result. When inlined into another elemental, it can be appended + to that elemental's yield cleanup. }]; let arguments = (ins AnyType:$element_value); + let regions = (region MaxSizedRegion<1>:$cleanup); - let assemblyFormat = "$element_value attr-dict `:` type($element_value)"; + let assemblyFormat = "$element_value attr-dict `:` type($element_value) custom<YieldOpCleanup>($cleanup)"; } def hlfir_ApplyOp : hlfir_Op<"apply", [NoMemoryEffect, AttrSizedOperandSegments]> { @@ -1230,10 +1241,9 @@ def hlfir_DestroyOp : hlfir_Op<"destroy", [MemoryEffects<[MemFree]>]> { is placed into a memory buffer, so that the library runtime can be called on it. The element type of the hlfir.expr must be derived type in this case. - It is not required to create an hlfir.destroy operation for and hlfir.expr - created inside an hlfir.elemental and returned in the hlfir.yield_element. - The last use of such expression is implicit and an hlfir.destroy could - not be emitted after the hlfir.yield_element since it is a terminator. + An expression created inside an hlfir.elemental and returned by its + hlfir.yield_element is destroyed in the yield's cleanup region, after + the element value has been consumed. Note that hlfir.destroy are currently generated by Fortran lowering that has a good view of the expression use contexts, but this will need to be diff --git a/flang/include/flang/Optimizer/Support/AllocationPolicy.h b/flang/include/flang/Optimizer/Support/AllocationPolicy.h index 43b6b7731928fc..f61864fb627589 100644 --- a/flang/include/flang/Optimizer/Support/AllocationPolicy.h +++ b/flang/include/flang/Optimizer/Support/AllocationPolicy.h @@ -116,7 +116,7 @@ bool shouldUseStackForCopyin( const AllocationSizeContext &sizeContext, std::optional<std::int64_t> alignment = std::nullopt); -/// Facts about a single existing array allocation used to decide its placement. +/// Facts about an existing allocation used to decide its placement. struct AllocationInfo : PendingAllocationInfo { /// The allocation operation (fir.alloca or fir.allocmem). mlir::Operation *op = nullptr; @@ -124,6 +124,12 @@ struct AllocationInfo : PendingAllocationInfo { bool isCurrentlyOnStack = false; }; +/// Return true if \p info describes a scalar character expression buffer: a +/// compiler temporary fir.allocmem of character type. Such buffers have +/// explicit lifetimes but retain their historical stack storage independently +/// of the array placement policy. +bool isCharacterTemporary(const AllocationInfo &info); + /// Size-based placement policy, usable before the allocation is created. /// Decides whether an allocation described by \p info should live on the stack, /// given the \p policy in effect and the per-function stack bytes already diff --git a/flang/lib/Lower/ConvertArrayConstructor.cpp b/flang/lib/Lower/ConvertArrayConstructor.cpp index a76527b4e74542..c01ddd6d4e71de 100644 --- a/flang/lib/Lower/ConvertArrayConstructor.cpp +++ b/flang/lib/Lower/ConvertArrayConstructor.cpp @@ -234,32 +234,11 @@ class AsElementalStrategy : public StrategyBase { elementResult = builder.createConvert(loc, exprType.getElementType(), elementResult); - // The clean-ups associated with the implied-do body operations - // must be initiated before the YieldElementOp, so we have to pop the scope - // right now. - stmtCtx.finalizeAndPop(); - - // This is a hacky way to get rid of the DestroyOp clean-up - // associated with the final ac-value result if it is hlfir.expr. - // Example: - // ... = (/(REPEAT(REPEAT(CHAR(i),2),2),i=1,n)/) - // Each intrinsic call lowering will produce hlfir.expr result - // with the associated clean-up, but only the last of them - // is wrong. It is wrong because the value is used in hlfir.yield_element, - // so it cannot be destroyed. - mlir::Operation *destroyOp = nullptr; - for (mlir::Operation *useOp : elementResult.getUsers()) - if (mlir::isa<hlfir::DestroyOp>(useOp)) { - if (destroyOp) - fir::emitFatalError(loc, - "multiple DestroyOp's for ac-value expression"); - destroyOp = useOp; - } - - if (destroyOp) - destroyOp->erase(); - - hlfir::YieldElementOp::create(builder, loc, elementResult); + auto yield = hlfir::YieldElementOp::create(builder, loc, elementResult); + Fortran::lower::genCleanUpInRegionIfAny(loc, builder, yield.getCleanup(), + stmtCtx); + if (yield.getCleanup().empty()) + stmtCtx.pop(); } // Override the default, because the context scope must be popped in diff --git a/flang/lib/Lower/ConvertCall.cpp b/flang/lib/Lower/ConvertCall.cpp index 8400743c0a30d9..52c17fd1313fb2 100644 --- a/flang/lib/Lower/ConvertCall.cpp +++ b/flang/lib/Lower/ConvertCall.cpp @@ -1178,8 +1178,12 @@ static hlfir::EntityWithAttributes genStmtFunctionRef( symMap.popScope(); // The result must not be a variable. result = hlfir::loadTrivialScalar(loc, builder, result); - if (result.isVariable()) + if (result.isVariable()) { result = hlfir::Entity{hlfir::AsExprOp::create(builder, loc, result)}; + fir::FirOpBuilder *bldr = &builder; + stmtCtx.attachCleanup( + [=]() { hlfir::DestroyOp::create(*bldr, loc, result); }); + } for (auto associate : exprAssociations) hlfir::EndAssociateOp::create(builder, loc, associate); return hlfir::EntityWithAttributes{result}; @@ -2730,18 +2734,20 @@ class ElementalCallBuilder { loc, "compute elemental PDT function result length parameters in HLFIR"); } - auto genKernel = [&](mlir::Location l, fir::FirOpBuilder &b, - mlir::ValueRange oneBasedIndices) -> hlfir::Entity { + auto genKernel = + [&](mlir::Location l, fir::FirOpBuilder &b, + mlir::ValueRange oneBasedIndices) -> hlfir::ElementalKernelResult { callContext.stmtCtx.pushScope(); for (auto &preparedActual : loweredActuals) if (preparedActual) preparedActual->setElementalIndices(oneBasedIndices); auto res = *impl().genElementalKernel(loweredActuals, callContext); - callContext.stmtCtx.finalizeAndPop(); - // Note that an hlfir.destroy is not emitted for the result since it - // is still used by the hlfir.yield_element that also marks its last - // use. - return res; + if (mlir::isa<hlfir::ExprType>(res.getType())) { + fir::FirOpBuilder *bldr = &b; + callContext.stmtCtx.attachCleanup( + [=]() { hlfir::DestroyOp::create(*bldr, l, res); }); + } + return {res, [&callContext]() { callContext.stmtCtx.finalizeAndPop(); }}; }; mlir::Value polymorphicMold; if (fir::isPolymorphicType(*callContext.resultType)) @@ -3812,9 +3818,14 @@ hlfir::Entity Fortran::lower::PreparedActualArgument::getActual( std::get<hlfir::ElementalAddrOp>(actual); mlir::IRMapping mapper; auto alwaysFalse = [](hlfir::ElementalOp) -> bool { return false; }; + llvm::SmallVector<hlfir::CleanupFunction> cleanups; mlir::Value addr = hlfir::inlineElementalOp( loc, builder, elementalAddr, *oneBasedElementalIndices, mapper, - /*mustRecursivelyInline=*/alwaysFalse); + /*mustRecursivelyInline=*/alwaysFalse, cleanups); + // Subscript expressions are evaluated outside elemental_addr and cleaned + // up by the enclosing statement. This call only clones the address kernel: + // it does not recursively inline applies (which could add element cleanups). + assert(cleanups.empty() && "non-recursive address inlining has no cleanups"); assert(elementalAddr.getCleanup().empty() && "no clean-up expected"); elementalAddr.erase(); return hlfir::Entity{addr}; diff --git a/flang/lib/Lower/ConvertExprToHLFIR.cpp b/flang/lib/Lower/ConvertExprToHLFIR.cpp index 745f88930858a5..1d91e8dc9060c5 100644 --- a/flang/lib/Lower/ConvertExprToHLFIR.cpp +++ b/flang/lib/Lower/ConvertExprToHLFIR.cpp @@ -1153,6 +1153,22 @@ HlfirDesignatorBuilder::convertVectorSubscriptedExprToElementalAddr( // Binary Operation implementation //===--------------------------------------------------------------------===// +/// Register the lifetime at the expression's creation point. Elemental kernels +/// use their own context, emitted in the yield_element cleanup region. +static void attachExprCleanup(mlir::Location loc, fir::FirOpBuilder &builder, + mlir::Value expr, + Fortran::lower::StatementContext &stmtCtx) { + fir::FirOpBuilder *bldr = &builder; + stmtCtx.attachCleanup([=]() { hlfir::DestroyOp::create(*bldr, loc, expr); }); +} + +static std::optional<hlfir::CleanupFunction> +getElementCleanup(Fortran::lower::StatementContext &stmtCtx) { + if (!stmtCtx.hasCode()) + return std::nullopt; + return [&stmtCtx]() { stmtCtx.finalizeAndReset(); }; +} + template <typename T> struct BinaryOp {}; @@ -1163,10 +1179,10 @@ struct BinaryOp {}; Fortran::evaluate::Type<Fortran::common::TypeCategory::GenBinTyCat>>> { \ using Op = Fortran::evaluate::GenBinEvOp< \ Fortran::evaluate::Type<Fortran::common::TypeCategory::GenBinTyCat>>; \ - static hlfir::EntityWithAttributes gen(mlir::Location loc, \ - fir::FirOpBuilder &builder, \ - const Op &, hlfir::Entity lhs, \ - hlfir::Entity rhs) { \ + static hlfir::EntityWithAttributes \ + gen(mlir::Location loc, fir::FirOpBuilder &builder, const Op &, \ + hlfir::Entity lhs, hlfir::Entity rhs, \ + Fortran::lower::StatementContext &stmtCtx) { \ if constexpr (Fortran::common::TypeCategory::GenBinTyCat == \ Fortran::common::TypeCategory::Unsigned) { \ return hlfir::EntityWithAttributes{ \ @@ -1200,10 +1216,10 @@ struct BinaryOp<Fortran::evaluate::Divide< Fortran::evaluate::Type<Fortran::common::TypeCategory::Complex>>> { using Op = Fortran::evaluate::Divide< Fortran::evaluate::Type<Fortran::common::TypeCategory::Complex>>; - static hlfir::EntityWithAttributes gen(mlir::Location loc, - fir::FirOpBuilder &builder, - const Op &op, hlfir::Entity lhs, - hlfir::Entity rhs) { + static hlfir::EntityWithAttributes + gen(mlir::Location loc, fir::FirOpBuilder &builder, const Op &op, + hlfir::Entity lhs, hlfir::Entity rhs, + Fortran::lower::StatementContext &stmtCtx) { const int kind = op.kind(); mlir::Type ty = Fortran::lower::getFIRType( builder.getContext(), Fortran::common::TypeCategory::Complex, kind, @@ -1225,10 +1241,10 @@ struct BinaryOp<Fortran::evaluate::Divide< template <Fortran::common::TypeCategory TC> struct BinaryOp<Fortran::evaluate::Power<Fortran::evaluate::Type<TC>>> { using Op = Fortran::evaluate::Power<Fortran::evaluate::Type<TC>>; - static hlfir::EntityWithAttributes gen(mlir::Location loc, - fir::FirOpBuilder &builder, - const Op &op, hlfir::Entity lhs, - hlfir::Entity rhs) { + static hlfir::EntityWithAttributes + gen(mlir::Location loc, fir::FirOpBuilder &builder, const Op &op, + hlfir::Entity lhs, hlfir::Entity rhs, + Fortran::lower::StatementContext &stmtCtx) { const int kind = op.kind(); mlir::Type ty = Fortran::lower::getFIRType(builder.getContext(), TC, kind, /*params=*/{}); @@ -1240,10 +1256,10 @@ template <Fortran::common::TypeCategory TC> struct BinaryOp< Fortran::evaluate::RealToIntPower<Fortran::evaluate::Type<TC>>> { using Op = Fortran::evaluate::RealToIntPower<Fortran::evaluate::Type<TC>>; - static hlfir::EntityWithAttributes gen(mlir::Location loc, - fir::FirOpBuilder &builder, - const Op &op, hlfir::Entity lhs, - hlfir::Entity rhs) { + static hlfir::EntityWithAttributes + gen(mlir::Location loc, fir::FirOpBuilder &builder, const Op &op, + hlfir::Entity lhs, hlfir::Entity rhs, + Fortran::lower::StatementContext &stmtCtx) { const int kind = op.kind(); mlir::Type ty = Fortran::lower::getFIRType(builder.getContext(), TC, kind, /*... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/239312 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
