[flang-commits] [flang] [flang] Classify MOVE_ALLOC with noncoarray FROM as SIMPLE (PR #224923)
Šárka Holendová via flang-commits
flang-commits at lists.llvm.org
Fri Oct 9 14:57:57 PDT 2026
https://github.com/mlir-maiden updated https://github.com/llvm/llvm-project/pull/224923
>From dd05cd8925f9141d084381a7ff484c5db2975eb0 Mon Sep 17 00:00:00 2001
From: Sarka Holendova <sarka.holendova at gmail.com>
Date: Sun, 20 Sep 2026 08:08:02 -0400
Subject: [PATCH 1/2] [flang] Classify MOVE_ALLOC with noncoarray FROM as
SIMPLE
F2023 16.1(5) classifies MOVE_ALLOC as SIMPLE when its FROM argument is
not a coarray. Implement this conditional classification.
---
flang/lib/Evaluate/intrinsics.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp
index 88874f7ef08e88..39565e2fb2d60e 100644
--- a/flang/lib/Evaluate/intrinsics.cpp
+++ b/flang/lib/Evaluate/intrinsics.cpp
@@ -2876,8 +2876,10 @@ std::optional<SpecificCall> IntrinsicInterface::Match(
}
if (call.isSubroutineCall) {
if (intrinsicClass == IntrinsicClass::pureSubroutine /* MOVE_ALLOC */) {
- // TODO: set Attr::Simple for MOVE_ALLOC when FROM is not a coarray
- // (F2023)
+ // F2023 16.1(5): MOVE_ALLOC with noncoarray FROM is SIMPLE
+ if (!IsCoarray(*rearranged[0])) {
+ attrs.set(characteristics::Procedure::Attr::Simple);
+ }
attrs.set(characteristics::Procedure::Attr::Pure);
} else if (intrinsicClass == IntrinsicClass::simpleSubroutine ||
intrinsicClass == IntrinsicClass::simpleElementalSubroutine) {
>From f57092f80cc8409f0a09e717e9792aae5d29765c Mon Sep 17 00:00:00 2001
From: Sarka Holendova <sarka.holendova at gmail.com>
Date: Fri, 9 Oct 2026 14:56:50 -0700
Subject: [PATCH 2/2] [flang] Update MOVE_ALLOC SIMPLE classification status in
F202X.md
---
flang/docs/F202X.md | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/flang/docs/F202X.md b/flang/docs/F202X.md
index 7d0cf26dbaa2c1..160f6f85c5e196 100644
--- a/flang/docs/F202X.md
+++ b/flang/docs/F202X.md
@@ -175,8 +175,14 @@ This makes `SIMPLE` a lower-priority feature.
- `PURE` procedures do not satisfy `SIMPLE` requirements
- `SIMPLE`/`IMPURE` conflicts are diagnosed
- Use-associated `SIMPLE` procedures are correctly recognized
-- Additional `SIMPLE` semantic constraints remain to be implemented
-- Intrinsic procedures are not yet marked as `SIMPLE` (planned as follow-up work)
+- Additional `SIMPLE` semantic constraints remain to be implemented (see #221457)
+- F2023 16.1 p2: All standard intrinsic functions are classified as `SIMPLE`
+- F2023 16.1 p5: `MVBITS`, `SPLIT`, and both forms of `TOKENIZE` are classified
+ as `SIMPLE` intrinsic subroutines
+- F2023 16.1 p5: Conditional `SIMPLE` classification of `MOVE_ALLOC` is
+ implemented when `FROM` is not a coarray
+- Intrinsic module procedures are not yet classified as `SIMPLE`
+- Lowering does not yet propagate the `SIMPLE` attribute to FIR procedure attributes (see #222360)
#### Conditional expressions and actual arguments
More information about the flang-commits
mailing list