[flang-commits] [flang] [flang] Rely on global initialization for simpler derived types (PR #114002)
via flang-commits
flang-commits at lists.llvm.org
Tue Oct 29 03:09:53 PDT 2024
================
@@ -793,11 +794,35 @@ void Fortran::lower::defaultInitializeAtRuntime(
})
.end();
} else {
- mlir::Value box = builder.createBox(loc, exv);
- fir::runtime::genDerivedTypeInitialize(builder, loc, box);
+ /// For "simpler" types, relying on "_FortranAInitialize"
+ /// leads to poor runtime performance. Hence optimize
+ /// the same.
+ const Fortran::semantics::DeclTypeSpec *declTy = sym.GetType();
+ mlir::Type symTy = converter.genType(var);
+ if (!var.isAlias() && !hasAllocatableDirectComponent(sym) &&
----------------
jeanPerier wrote:
Why excluding allocatable components but not pointer components while the job is usually simpler or equivalent for allocatable components (just initialize the descriptor member to unallocated status)?
https://github.com/llvm/llvm-project/pull/114002
More information about the flang-commits
mailing list