[flang-commits] [clang] [flang] [clang][flang] Add support for -finit-local-zero (PR #159788)
via flang-commits
flang-commits at lists.llvm.org
Wed Oct 22 07:23:36 PDT 2025
================
@@ -384,6 +384,159 @@ class TypeInfoConverter {
llvm::SmallSetVector<Fortran::semantics::SymbolRef, 32> seen;
};
+// Helper class to encapsulate utilities 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 these utilities outside the
+// scope detailed here is discouraged, and is probably wrong.
+class ImplicitAssignmentGenerator {
----------------
jeanPerier wrote:
`createSingletonFromCode` is the implementation of `achar` in lowering, you can use that directly.
For `ieee_value(x, ieee_quiet_nan)`, you can use `fir::IntrinsicLibrary::genQNan` defined [here ](project/blob/0b9ed5dc64149147aadc588d9077d80fb73a54d6/flang/include/flang/Optimizer/Builder/IntrinsicCall.h#L517C15-L517C22).
I expect you may want to support snan/inf/+inf, and while there may not be existing FIR level helper to get them, I pretty sure you can easily extract the implementation to get those from ieee_value implementation in IntrinsicCall.cpp (just like `genQNan` did).
> how we could directly emit such assignments as I exemplified here through HLFIR
Why is hlfir.assign not covering your use case? It implements the Fortran intrinsic assignment.
https://github.com/llvm/llvm-project/pull/159788
More information about the flang-commits
mailing list