[flang-commits] [flang] [llvm] [flang-rt] - Lightweight runtime assignment function (AssignSimple) for intrinsic-type assignments (PR #213704)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Tue Aug 4 04:03:18 PDT 2026
================
@@ -851,6 +852,218 @@ void RTDEF(AssignExplicitLengthCharacter)(Descriptor &to,
ExplicitLengthCharacterLHS);
}
+void RTDEF(AssignSimple)(Descriptor &to, const Descriptor &from,
+ const char *sourceFile, int sourceLine) {
+ Terminator terminator{sourceFile, sourceLine};
+ // AssignSimple: fast path for intrinsic type assignments (integer, real,
+ // complex, logical). The compiler routes here only when:
+ // - LHS element type is trivial (isa_trivial), not derived/polymorphic
+ // - LHS and RHS ranks match (no scalar-to-array broadcasting)
+ // - LHS is not volatile (volatile needs memory ordering semantics)
+
+ if (to.rank() != from.rank()) {
+ terminator.Crash("AssignSimple: rank mismatch (to.rank=%d, from.rank=%d)",
+ to.rank(), from.rank());
+ }
+ if (to.ElementBytes() != from.ElementBytes()) {
+ terminator.Crash("AssignSimple: ElementBytes mismatch (to.ElementBytes=%d, "
+ "from.ElementBytes=%d)",
----------------
tblah wrote:
Is %d safe for ElementBytes()?
https://github.com/llvm/llvm-project/pull/213704
More information about the flang-commits
mailing list