r343617 - [OpenMP] Simplify code for reductions on distribute directives, NFC.

Jonas Hahnfeld via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 2 12:12:47 PDT 2018


Author: hahnfeld
Date: Tue Oct  2 12:12:47 2018
New Revision: 343617

URL: http://llvm.org/viewvc/llvm-project?rev=343617&view=rev
Log:
[OpenMP] Simplify code for reductions on distribute directives, NFC.

Only need to care about the 'distribute simd' case, all other composite
directives are handled elsewhere. This was already reflected in the
outer 'if' condition, so all other inner conditions could never be true.

Differential Revision: https://reviews.llvm.org/D52731

Modified:
    cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp

Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=343617&r1=343616&r2=343617&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Tue Oct  2 12:12:47 2018
@@ -3400,20 +3400,7 @@ void CodeGenFunction::EmitOMPDistributeL
       if (isOpenMPSimdDirective(S.getDirectiveKind()) &&
           !isOpenMPParallelDirective(S.getDirectiveKind()) &&
           !isOpenMPTeamsDirective(S.getDirectiveKind())) {
-        OpenMPDirectiveKind ReductionKind = OMPD_unknown;
-        if (isOpenMPParallelDirective(S.getDirectiveKind()) &&
-            isOpenMPSimdDirective(S.getDirectiveKind())) {
-          ReductionKind = OMPD_parallel_for_simd;
-        } else if (isOpenMPParallelDirective(S.getDirectiveKind())) {
-          ReductionKind = OMPD_parallel_for;
-        } else if (isOpenMPSimdDirective(S.getDirectiveKind())) {
-          ReductionKind = OMPD_simd;
-        } else if (!isOpenMPTeamsDirective(S.getDirectiveKind()) &&
-                   S.hasClausesOfKind<OMPReductionClause>()) {
-          llvm_unreachable(
-              "No reduction clauses is allowed in distribute directive.");
-        }
-        EmitOMPReductionClauseFinal(S, ReductionKind);
+        EmitOMPReductionClauseFinal(S, OMPD_simd);
         // Emit post-update of the reduction variables if IsLastIter != 0.
         emitPostUpdateForReductionClause(
             *this, S, [IL, &S](CodeGenFunction &CGF) {




More information about the cfe-commits mailing list