================
@@ -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;
----------------
doru1004 wrote:

I don't think it is possible to have the analysis in Sema and not use a flag 
here.

The two options we have are:
1. Do the analysis in Sema and have the flag and then read the flag in CG.
2. Have the analysis in CG and then there's no reason to pass anything around 
and CG can call the function when needed.

There is a 3rd hybrid way to do this where this function is moved back into CG:
```
bool Sema::teamsLoopCanBeParallelFor(Stmt *AStmt) {
  TeamsLoopChecker Checker(*this);
  Checker.Visit(AStmt);
  return Checker.teamsLoopCanBeParallelFor();
}
```

But then I don't know how you can call the TeamsLoopChecker which lives in Sema.

https://github.com/llvm/llvm-project/pull/72417
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to