r265123 - [OPENMP] Avoid useless recursive calls in getDSA if it is called in a loop, NFC
Dmitry Polukhin via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 1 02:52:31 PDT 2016
Author: dpolukhin
Date: Fri Apr 1 04:52:30 2016
New Revision: 265123
URL: http://llvm.org/viewvc/llvm-project?rev=265123&view=rev
Log:
[OPENMP] Avoid useless recursive calls in getDSA if it is called in a loop, NFC
Modified:
cfe/trunk/lib/Sema/SemaOpenMP.cpp
Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=265123&r1=265122&r2=265123&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Fri Apr 1 04:52:30 2016
@@ -141,7 +141,7 @@ private:
typedef SmallVector<SharingMapTy, 8>::reverse_iterator reverse_iterator;
- DSAVarData getDSA(StackTy::reverse_iterator Iter, ValueDecl *D);
+ DSAVarData getDSA(StackTy::reverse_iterator& Iter, ValueDecl *D);
/// \brief Checks if the variable is a local for OpenMP region.
bool isOpenMPLocal(VarDecl *D, StackTy::reverse_iterator Iter);
@@ -396,7 +396,7 @@ static ValueDecl *getCanonicalDecl(Value
return D;
}
-DSAStackTy::DSAVarData DSAStackTy::getDSA(StackTy::reverse_iterator Iter,
+DSAStackTy::DSAVarData DSAStackTy::getDSA(StackTy::reverse_iterator& Iter,
ValueDecl *D) {
D = getCanonicalDecl(D);
auto *VD = dyn_cast<VarDecl>(D);
@@ -505,7 +505,7 @@ DSAStackTy::DSAVarData DSAStackTy::getDS
// For constructs other than task, if no default clause is present, these
// variables inherit their data-sharing attributes from the enclosing
// context.
- return getDSA(std::next(Iter), D);
+ return getDSA(++Iter, D);
}
Expr *DSAStackTy::addUniqueAligned(ValueDecl *D, Expr *NewDE) {
@@ -722,7 +722,7 @@ DSAStackTy::DSAVarData DSAStackTy::hasDS
bool FromParent) {
D = getCanonicalDecl(D);
auto StartI = std::next(Stack.rbegin());
- auto EndI = std::prev(Stack.rend());
+ auto EndI = Stack.rend();
if (FromParent && StartI != EndI) {
StartI = std::next(StartI);
}
@@ -742,7 +742,7 @@ DSAStackTy::hasInnermostDSA(ValueDecl *D
DirectivesPredicate DPred, bool FromParent) {
D = getCanonicalDecl(D);
auto StartI = std::next(Stack.rbegin());
- auto EndI = std::prev(Stack.rend());
+ auto EndI = Stack.rend();
if (FromParent && StartI != EndI) {
StartI = std::next(StartI);
}
More information about the cfe-commits
mailing list