[clang] [flang] [flang] Add support for -finit-local-zero (PR #159788)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 28 00:59:24 PDT 2026


================
@@ -1225,6 +1226,69 @@ getSafeRepackAttrs(Fortran::lower::AbstractConverter &converter) {
   return attrs.empty() ? mlir::ArrayAttr{} : builder.getArrayAttr(attrs);
 }
 
+// Helper function to related to emission of implicit
+// assignments. `Implicit` here implies the assignment does not
+// exist in the Fortran source, but is implicit through definition
+// of one or more flagsets (like -finit-* family of flags).
+// General purpose usage of this function outside the
+// scope detailed here is discouraged, and is probably wrong.
+static void emitImplicitAssignment(Fortran::lower::AbstractConverter &converter,
+                                   mlir::Location loc,
+                                   const Fortran::semantics::Symbol &sym,
+                                   Fortran::lower::SymMap &symMap) {
+  if (converter.getLoweringOptions().getInitLocalZeroDef()) {
----------------
jeanPerier wrote:

Can you move that up before the `isEligibleForImplicitAssignment` so that normal compilation do not pay the price of executing `isEligibleForImplicitAssignment()` when the option is off?

https://github.com/llvm/llvm-project/pull/159788


More information about the cfe-commits mailing list