[clang] cb9191c - [OPENMP]Improve code readability, NFC.

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 9 05:50:45 PDT 2020


Author: Alexey Bataev
Date: 2020-06-09T08:50:36-04:00
New Revision: cb9191c0424b9112bf93a3526bcabbe87cd35a92

URL: https://github.com/llvm/llvm-project/commit/cb9191c0424b9112bf93a3526bcabbe87cd35a92
DIFF: https://github.com/llvm/llvm-project/commit/cb9191c0424b9112bf93a3526bcabbe87cd35a92.diff

LOG: [OPENMP]Improve code readability, NFC.

Reuse existing function instead of code duplication and use better type.

Added: 
    

Modified: 
    clang/lib/CodeGen/CGStmtOpenMP.cpp
    clang/lib/CodeGen/CodeGenFunction.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 23952309b61f..664aeccfe7b9 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<void(CodeGenFunction &)> BodyGen,
     const llvm::function_ref<void(CodeGenFunction &)> 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 cfd9950066bb..c9fcaf9d0f5e 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -3389,8 +3389,8 @@ class CodeGenFunction : public CodeGenTypeCache {
   /// \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<void(CodeGenFunction &)> BodyGen,
       const llvm::function_ref<void(CodeGenFunction &)> PostIncGen);
 


        


More information about the cfe-commits mailing list