Skip to content

[flang][DRAFT] Copy-in/Copy-out determination #151408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

eugeneepshteyn
Copy link
Contributor

Plumbing/API for copy-in/copy-out work

}
// TODO: at this point have dummy arguments as procInfo->dummyArguments
// and have actual arguments via arguments_
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here go through the actual args and dummy args and determine copy-in and copy-out needs.

Copy link

github-actions bot commented Jul 30, 2025

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- flang/include/flang/Evaluate/call.h flang/lib/Evaluate/call.cpp
View the diff from clang-format here.
diff --git a/flang/lib/Evaluate/call.cpp b/flang/lib/Evaluate/call.cpp
index c558335c1..5a94071d9 100644
--- a/flang/lib/Evaluate/call.cpp
+++ b/flang/lib/Evaluate/call.cpp
@@ -254,8 +254,8 @@ void ProcedureRef::DetermineCopyInOut() {
   }
   // Get folding context of the call site owner
   FoldingContext &fc{proc_.GetSymbol()->owner().context().foldingContext()};
-  auto procInfo{characteristics::Procedure::Characterize(
-      proc_, fc, /*emitError=*/true)};
+  auto procInfo{
+      characteristics::Procedure::Characterize(proc_, fc, /*emitError=*/true)};
   if (!procInfo) {
     return;
   }

Copy link
Contributor

@klausler klausler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be cleaner to do the analysis at the time that the ProcedureRef is created by expression semantics rather than patching the IR later in lowering. It could then be used in Semantics/check-call.cpp for all of the errors and warnings that depend on copy-in/copy-out instead of the ad-hoc analysis currently done that relies on contiguity &c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants