[clang] [OpenMP][CodeGen] Improved codegen for combined loop directives (PR #72417)
David Pagan via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 10 12:49:21 PST 2024
================
@@ -6106,6 +6106,8 @@ class OMPTeamsGenericLoopDirective final : public OMPLoopDirective {
class OMPTargetTeamsGenericLoopDirective final : public OMPLoopDirective {
friend class ASTStmtReader;
friend class OMPExecutableDirective;
+ /// true if loop directive's associated loop can be a parallel for.
+ bool CanBeParallelFor = false;
----------------
ddpagan wrote:
Hi Alexey - thanks for the comment. A clarification, as I'm not sure exactly what you're referring to.
So currently, when OMPTargetTeamsGenericLoopDirective is created in SemaOpenMP.cpp, teamsLoopCanBeParallelFor(AStmt) is called as an argument to the create, the result of which is stored in CanBeParallelFor. Later, when the directive is seen in CodeGen/CGStmtOpenMP.cpp, the boolean CanBeParallelFor (via the function canBeParallelFor()) is checked to determine how to emit the directive (parallel or distribute).
Are you saying that instead of checking whether the loop can be parallel while we're in Sema, and saving that value when we create the target teams loop directive, that we should determine this through a call to the Sema function teamsLoopCanBeParallelFor() while in CodeGen?
https://github.com/llvm/llvm-project/pull/72417
More information about the cfe-commits
mailing list