From cb9191c0424b9112bf93a3526bcabbe87cd35a92 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Tue, 9 Jun 2020 08:04:48 -0400 Subject: [PATCH] [OPENMP]Improve code readability, NFC. Reuse existing function instead of code duplication and use better type. --- clang/lib/CodeGen/CGStmtOpenMP.cpp | 13 ++++++------- clang/lib/CodeGen/CodeGenFunction.h | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index 2395230..664aecc 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -1747,7 +1747,7 @@ void CodeGenFunction::EmitOMPLoopBody(const OMPLoopDirective &D, } void CodeGenFunction::EmitOMPInnerLoop( - const Stmt &S, bool RequiresCleanup, const Expr *LoopCond, + const OMPExecutableDirective &S, bool RequiresCleanup, const Expr *LoopCond, const Expr *IncExpr, const llvm::function_ref BodyGen, const llvm::function_ref PostIncGen) { @@ -2248,8 +2248,8 @@ static void emitOMPSimdRegion(CodeGenFunction &CGF, const OMPLoopDirective &S, CGF.EmitOMPInnerLoop( S, LoopScope.requiresCleanups(), S.getCond(), S.getInc(), [&S](CodeGenFunction &CGF) { - CGF.EmitOMPLoopBody(S, CodeGenFunction::JumpDest()); - CGF.EmitStopPoint(&S); + emitOMPLoopBodyWithStopPoint(CGF, S, + CodeGenFunction::JumpDest()); }, [](CodeGenFunction &) {}); }); @@ -2916,8 +2916,7 @@ bool CodeGenFunction::EmitOMPWorksharingLoop( : S.getCond(), StaticChunkedOne ? S.getDistInc() : S.getInc(), [&S, LoopExit](CodeGenFunction &CGF) { - CGF.EmitOMPLoopBody(S, LoopExit); - CGF.EmitStopPoint(&S); + emitOMPLoopBodyWithStopPoint(CGF, S, LoopExit); }, [](CodeGenFunction &) {}); }); @@ -6135,8 +6134,8 @@ void CodeGenFunction::EmitOMPTaskLoopBasedDirective(const OMPLoopDirective &S) { CGF.EmitOMPInnerLoop( S, LoopScope.requiresCleanups(), S.getCond(), S.getInc(), [&S](CodeGenFunction &CGF) { - CGF.EmitOMPLoopBody(S, CodeGenFunction::JumpDest()); - CGF.EmitStopPoint(&S); + emitOMPLoopBodyWithStopPoint(CGF, S, + CodeGenFunction::JumpDest()); }, [](CodeGenFunction &) {}); }); diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index cfd9950..c9fcaf9 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -3389,8 +3389,8 @@ public: /// \param PostIncGen Genrator for post-increment code (required for ordered /// loop directvies). void EmitOMPInnerLoop( - const Stmt &S, bool RequiresCleanup, const Expr *LoopCond, - const Expr *IncExpr, + const OMPExecutableDirective &S, bool RequiresCleanup, + const Expr *LoopCond, const Expr *IncExpr, const llvm::function_ref BodyGen, const llvm::function_ref PostIncGen); -- 2.7.4