diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 10 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGStmtOpenMP.cpp | 20 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 3 | ||||
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTReaderStmt.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriterStmt.cpp | 3 |
6 files changed, 14 insertions, 30 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index 09bb17b0e70..d2a6a9c7ee6 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -1636,7 +1636,7 @@ OMPSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc, Dir->setLastIteration(Exprs.LastIteration); Dir->setCalcLastIteration(Exprs.CalcLastIteration); Dir->setPreCond(Exprs.PreCond); - Dir->setCond(Exprs.Cond, Exprs.SeparatedCond); + Dir->setCond(Exprs.Cond); Dir->setInit(Exprs.Init); Dir->setInc(Exprs.Inc); Dir->setCounters(Exprs.Counters); @@ -1675,7 +1675,7 @@ OMPForDirective::Create(const ASTContext &C, SourceLocation StartLoc, Dir->setLastIteration(Exprs.LastIteration); Dir->setCalcLastIteration(Exprs.CalcLastIteration); Dir->setPreCond(Exprs.PreCond); - Dir->setCond(Exprs.Cond, Exprs.SeparatedCond); + Dir->setCond(Exprs.Cond); Dir->setInit(Exprs.Init); Dir->setInc(Exprs.Inc); Dir->setIsLastIterVariable(Exprs.IL); @@ -1721,7 +1721,7 @@ OMPForSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc, Dir->setLastIteration(Exprs.LastIteration); Dir->setCalcLastIteration(Exprs.CalcLastIteration); Dir->setPreCond(Exprs.PreCond); - Dir->setCond(Exprs.Cond, Exprs.SeparatedCond); + Dir->setCond(Exprs.Cond); Dir->setInit(Exprs.Init); Dir->setInc(Exprs.Inc); Dir->setIsLastIterVariable(Exprs.IL); @@ -1876,7 +1876,7 @@ OMPParallelForDirective *OMPParallelForDirective::Create( Dir->setLastIteration(Exprs.LastIteration); Dir->setCalcLastIteration(Exprs.CalcLastIteration); Dir->setPreCond(Exprs.PreCond); - Dir->setCond(Exprs.Cond, Exprs.SeparatedCond); + Dir->setCond(Exprs.Cond); Dir->setInit(Exprs.Init); Dir->setInc(Exprs.Inc); Dir->setIsLastIterVariable(Exprs.IL); @@ -1920,7 +1920,7 @@ OMPParallelForSimdDirective *OMPParallelForSimdDirective::Create( Dir->setLastIteration(Exprs.LastIteration); Dir->setCalcLastIteration(Exprs.CalcLastIteration); Dir->setPreCond(Exprs.PreCond); - Dir->setCond(Exprs.Cond, Exprs.SeparatedCond); + Dir->setCond(Exprs.Cond); Dir->setInit(Exprs.Init); Dir->setInc(Exprs.Inc); Dir->setIsLastIterVariable(Exprs.IL); diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index 895baa72a7d..a6da3891af5 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -489,8 +489,7 @@ void CodeGenFunction::EmitOMPParallelDirective(const OMPParallelDirective &S) { emitCommonOMPParallelDirective(*this, S, CodeGen); } -void CodeGenFunction::EmitOMPLoopBody(const OMPLoopDirective &S, - bool SeparateIter) { +void CodeGenFunction::EmitOMPLoopBody(const OMPLoopDirective &S) { RunCleanupsScope BodyScope(*this); // Update counters values on current iteration. for (auto I : S.updates()) { @@ -512,12 +511,10 @@ void CodeGenFunction::EmitOMPLoopBody(const OMPLoopDirective &S, // The end (updates/cleanups). EmitBlock(Continue.getBlock()); BreakContinueStack.pop_back(); - if (SeparateIter) { // TODO: Update lastprivates if the SeparateIter flag is true. // This will be implemented in a follow-up OMPLastprivateClause patch, but // result should be still correct without it, as we do not make these // variables private yet. - } } void CodeGenFunction::EmitOMPInnerLoop( @@ -734,7 +731,6 @@ void CodeGenFunction::EmitOMPSimdDirective(const OMPSimdDirective &S) { CGF.incrementProfileCounter(&S); } // Walk clauses and process safelen/lastprivate. - bool SeparateIter = false; CGF.LoopStack.setParallel(); CGF.LoopStack.setVectorizerEnable(true); for (auto C : S.clauses()) { @@ -754,7 +750,6 @@ void CodeGenFunction::EmitOMPSimdDirective(const OMPSimdDirective &S) { EmitOMPAlignedClause(CGF, CGF.CGM, cast<OMPAlignedClause>(*C)); break; case OMPC_lastprivate: - SeparateIter = true; break; default: // Not handled yet @@ -805,15 +800,12 @@ void CodeGenFunction::EmitOMPSimdDirective(const OMPSimdDirective &S) { CGF.EmitOMPPrivateClause(S, LoopScope); (void)LoopScope.Privatize(); CGF.EmitOMPInnerLoop(S, LoopScope.requiresCleanups(), - S.getCond(SeparateIter), S.getInc(), + S.getCond(), S.getInc(), [&S](CodeGenFunction &CGF) { CGF.EmitOMPLoopBody(S); CGF.EmitStopPoint(&S); }, [](CodeGenFunction &) {}); - if (SeparateIter) { - CGF.EmitOMPLoopBody(S, /*SeparateIter=*/true); - } } CGF.EmitOMPSimdFinal(S); // Emit: if (PreCond) - end. @@ -914,7 +906,7 @@ void CodeGenFunction::EmitOMPForOuterLoop(OpenMPScheduleClauseKind ScheduleKind, // IV = LB EmitIgnoredExpr(S.getInit()); // IV < UB - BoolCondVal = EvaluateExprAsBool(S.getCond(false)); + BoolCondVal = EvaluateExprAsBool(S.getCond()); } else { BoolCondVal = RT.emitForNext(*this, S.getLocStart(), IVSize, IVSigned, IL, LB, UB, ST); @@ -950,7 +942,7 @@ void CodeGenFunction::EmitOMPForOuterLoop(OpenMPScheduleClauseKind ScheduleKind, ScheduleKind == OMPC_SCHEDULE_guided) && !Ordered); EmitOMPInnerLoop( - S, LoopScope.requiresCleanups(), S.getCond(/*SeparateIter=*/false), + S, LoopScope.requiresCleanups(), S.getCond(), S.getInc(), [&S](CodeGenFunction &CGF) { CGF.EmitOMPLoopBody(S); @@ -1108,8 +1100,8 @@ bool CodeGenFunction::EmitOMPWorksharingLoop(const OMPLoopDirective &S) { // IV = LB; EmitIgnoredExpr(S.getInit()); // while (idx <= UB) { BODY; ++idx; } - EmitOMPInnerLoop(S, LoopScope.requiresCleanups(), - S.getCond(/*SeparateIter=*/false), S.getInc(), + EmitOMPInnerLoop(S, LoopScope.requiresCleanups(), S.getCond(), + S.getInc(), [&S](CodeGenFunction &CGF) { CGF.EmitOMPLoopBody(S); CGF.EmitStopPoint(&S); diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 469022dc62e..b3c31f61d1a 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -2189,8 +2189,7 @@ public: private: /// Helpers for the OpenMP loop directives. - void EmitOMPLoopBody(const OMPLoopDirective &Directive, - bool SeparateIter = false); + void EmitOMPLoopBody(const OMPLoopDirective &Directive); void EmitOMPSimdFinal(const OMPLoopDirective &S); /// \brief Emit code for the worksharing loop-based directive. /// \return true, if this construct has any lastprivate clause, false - diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index cfe8db3d658..03d78f0bce8 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -2939,9 +2939,6 @@ CheckOpenMPLoop(OpenMPDirectiveKind DKind, Expr *NestedLoopCountExpr, ? SemaRef.BuildBinOp(CurScope, CondLoc, BO_LE, IV.get(), UB.get()) : SemaRef.BuildBinOp(CurScope, CondLoc, BO_LT, IV.get(), NumIterations.get()); - // Loop condition with 1 iteration separated (IV < LastIteration) - ExprResult SeparatedCond = SemaRef.BuildBinOp(CurScope, CondLoc, BO_LT, - IV.get(), LastIteration.get()); // Loop increment (IV = IV + 1) SourceLocation IncLoc; @@ -3071,7 +3068,6 @@ CheckOpenMPLoop(OpenMPDirectiveKind DKind, Expr *NestedLoopCountExpr, Built.CalcLastIteration = CalcLastIteration.get(); Built.PreCond = PreCond.get(); Built.Cond = Cond.get(); - Built.SeparatedCond = SeparatedCond.get(); Built.Init = Init.get(); Built.Inc = Inc.get(); Built.LB = LB.get(); diff --git a/clang/lib/Serialization/ASTReaderStmt.cpp b/clang/lib/Serialization/ASTReaderStmt.cpp index d84b5be5850..e0cd1898afa 100644 --- a/clang/lib/Serialization/ASTReaderStmt.cpp +++ b/clang/lib/Serialization/ASTReaderStmt.cpp @@ -2073,9 +2073,7 @@ void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) { D->setLastIteration(Reader.ReadSubExpr()); D->setCalcLastIteration(Reader.ReadSubExpr()); D->setPreCond(Reader.ReadSubExpr()); - auto Fst = Reader.ReadSubExpr(); - auto Snd = Reader.ReadSubExpr(); - D->setCond(Fst, Snd); + D->setCond(Reader.ReadSubExpr()); D->setInit(Reader.ReadSubExpr()); D->setInc(Reader.ReadSubExpr()); if (isOpenMPWorksharingDirective(D->getDirectiveKind())) { diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp index 00356f82047..4c12d957dfe 100644 --- a/clang/lib/Serialization/ASTWriterStmt.cpp +++ b/clang/lib/Serialization/ASTWriterStmt.cpp @@ -1929,8 +1929,7 @@ void ASTStmtWriter::VisitOMPLoopDirective(OMPLoopDirective *D) { Writer.AddStmt(D->getLastIteration()); Writer.AddStmt(D->getCalcLastIteration()); Writer.AddStmt(D->getPreCond()); - Writer.AddStmt(D->getCond(/* SeparateIter */ false)); - Writer.AddStmt(D->getCond(/* SeparateIter */ true)); + Writer.AddStmt(D->getCond()); Writer.AddStmt(D->getInit()); Writer.AddStmt(D->getInc()); if (isOpenMPWorksharingDirective(D->getDirectiveKind())) { |