diff --git a/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp b/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp --- a/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp +++ b/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp @@ -221,7 +221,8 @@ if (embox.getHost()) { // Create the thunk. auto module = embox->getParentOfType(); - FirOpBuilder builder(rewriter, getKindMapping(module)); + fir::KindMapping kindMap = getKindMapping(module); + FirOpBuilder builder(rewriter, kindMap); auto loc = embox.getLoc(); mlir::Type i8Ty = builder.getI8Type(); mlir::Type i8Ptr = builder.getRefType(i8Ty); diff --git a/flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp b/flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp --- a/flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp +++ b/flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp @@ -809,7 +809,8 @@ auto triples = sliceOp.getTriples(); const std::size_t tripleSize = triples.size(); auto module = arrLoad->getParentOfType(); - FirOpBuilder builder(rewriter, getKindMapping(module)); + fir::KindMapping kindMap = getKindMapping(module); + FirOpBuilder builder(rewriter, kindMap); size = builder.genExtentFromTriplet(loc, triples[tripleSize - 3], triples[tripleSize - 2], triples[tripleSize - 1], idxTy); @@ -895,7 +896,8 @@ assert(seqTy && seqTy.isa()); const auto dimension = seqTy.cast().getDimension(); auto module = load->getParentOfType(); - FirOpBuilder builder(rewriter, getKindMapping(module)); + fir::KindMapping kindMap = getKindMapping(module); + FirOpBuilder builder(rewriter, kindMap); auto typeparams = getTypeParamsIfRawData(loc, builder, load, alloc.getType()); mlir::Value result = rewriter.create( loc, eleTy, alloc, shape, slice, @@ -959,7 +961,8 @@ // Reverse the indices so they are in column-major order. std::reverse(indices.begin(), indices.end()); auto module = arrLoad->getParentOfType(); - FirOpBuilder builder(rewriter, getKindMapping(module)); + fir::KindMapping kindMap = getKindMapping(module); + FirOpBuilder builder(rewriter, kindMap); auto fromAddr = rewriter.create( loc, getEleTy(src.getType()), src, shapeOp, CopyIn && copyUsingSlice ? sliceOp : mlir::Value{}, @@ -997,7 +1000,8 @@ if (auto charTy = eleTy.dyn_cast()) { assert(load.getMemref().getType().isa()); auto module = load->getParentOfType(); - FirOpBuilder builder(rewriter, getKindMapping(module)); + fir::KindMapping kindMap = getKindMapping(module); + FirOpBuilder builder(rewriter, kindMap); return {getCharacterLen(loc, builder, load, charTy)}; } TODO(loc, "unhandled dynamic type parameters"); @@ -1049,12 +1053,14 @@ loc, fir::BoxType::get(baseType), allocmem, shape, /*slice=*/mlir::Value{}, typeParams); auto module = load->getParentOfType(); - FirOpBuilder builder(rewriter, getKindMapping(module)); + fir::KindMapping kindMap = getKindMapping(module); + FirOpBuilder builder(rewriter, kindMap); runtime::genDerivedTypeInitialize(builder, loc, box); // Any allocatable component that may have been allocated must be // deallocated during the clean-up. auto cleanup = [=](mlir::PatternRewriter &r) { - FirOpBuilder builder(r, getKindMapping(module)); + fir::KindMapping kindMap = getKindMapping(module); + FirOpBuilder builder(r, kindMap); runtime::genDerivedTypeDestroy(builder, loc, box); r.create(loc, allocmem); };