From 475a7440f193dda74291bfea7bb0179f83a07a61 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Fri, 12 Jan 2018 19:39:11 +0000 Subject: [OPENMP] Replace calls of getAssociatedStmt(). getAssociatedStmt() returns the outermost captured statement for the OpenMP directive. It may return incorrect region in case of combined constructs. Reworked the code to reduce the number of calls of getAssociatedStmt() and used getInnermostCapturedStmt() and getCapturedStmt() functions instead. In case of firstprivate variables it may lead to an extra allocas generation for private copies even if the variable is passed by value into outlined function and could be used directly as private copy. llvm-svn: 322393 --- clang/lib/Sema/TreeTransform.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'clang/lib/Sema/TreeTransform.h') diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 96969ea87a1..ebfdbe83ef8 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -7642,11 +7642,7 @@ StmtResult TreeTransform::TransformOMPExecutableDirective( StmtResult Body; { Sema::CompoundScopeRAII CompoundScope(getSema()); - int ThisCaptureLevel = - Sema::getOpenMPCaptureLevels(D->getDirectiveKind()); - Stmt *CS = D->getAssociatedStmt(); - while (--ThisCaptureLevel >= 0) - CS = cast(CS)->getCapturedStmt(); + Stmt *CS = D->getInnermostCapturedStmt()->getCapturedStmt(); Body = getDerived().TransformStmt(CS); } AssociatedStmt = -- cgit v1.2.3