r301547 - [OPENMP] Improve performance of the hasDSA() function, NFC.
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 27 07:46:27 PDT 2017
Author: abataev
Date: Thu Apr 27 09:46:26 2017
New Revision: 301547
URL: http://llvm.org/viewvc/llvm-project?rev=301547&view=rev
Log:
[OPENMP] Improve performance of the hasDSA() function, NFC.
Remove some unneccesary code from the function after the fix for ASAN
buildbots.
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=301547&r1=301546&r2=301547&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Thu Apr 27 09:46:26 2017
@@ -824,23 +824,18 @@ DSAStackTy::hasDSA(ValueDecl *D,
if (isStackEmpty())
return {};
D = getCanonicalDecl(D);
- auto StartI = std::next(Stack.back().first.rbegin());
+ auto I = (FromParent && Stack.back().first.size() > 1)
+ ? std::next(Stack.back().first.rbegin())
+ : Stack.back().first.rbegin();
auto EndI = Stack.back().first.rend();
- if (FromParent && StartI != EndI)
- StartI = std::next(StartI);
- if (StartI == EndI)
- return {};
- auto I = std::prev(StartI);
do {
- ++I;
- if (I == EndI)
- break;
+ std::advance(I, 1);
if (!DPred(I->Directive) && !isParallelOrTaskRegion(I->Directive))
continue;
DSAVarData DVar = getDSA(I, D);
if (CPred(DVar.CKind))
return DVar;
- } while (I != EndI);
+ } while (std::distance(I, EndI) > 1);
return {};
}
More information about the cfe-commits
mailing list