[PATCH] D18474: [OPENMP] Enable correct generation of runtime call when target directive is separated from teams directive by multiple curly brackets

Samuel Antao via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 25 09:19:00 PDT 2016

sfantao added a comment.

Thanks for the fix!

Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:4257
@@ +4256,3 @@
+hasEnclosingTeams(const Stmt *TargetBody) {
+  if(auto *TeamsDir = dyn_cast<OMPTeamsDirective>(TargetBody)) return TeamsDir;
I think that this can be simplified to:

while (auto *S = dyn_cast<CompoundStmt>(TargetBody))
  TargetBody = S->body_front();

return dyn_cast<CompoundStmt>(OMPTeamsDirective);

I know that this is currently used only for teams, but I think it would be nice to make this a templated function to look for other possible nests. I suspect this will very useful for other cases like 'target teams parallel distribute'.



More information about the cfe-commits mailing list