diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2017-04-27 14:46:26 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2017-04-27 14:46:26 +0000 |
commit | 0e6fc1c2e9ac29d6755d121dd6bfd4f63103477a (patch) | |
tree | d824f390511277890f686d056cd7429d51069c15 /clang/lib/Sema/SemaOpenMP.cpp | |
parent | 14f10e03e05b1498bf4cb24b90c858687a9177e4 (diff) | |
download | bcm5719-llvm-0e6fc1c2e9ac29d6755d121dd6bfd4f63103477a.tar.gz bcm5719-llvm-0e6fc1c2e9ac29d6755d121dd6bfd4f63103477a.zip |
[OPENMP] Improve performance of the hasDSA() function, NFC.
Remove some unneccesary code from the function after the fix for ASAN
buildbots.
llvm-svn: 301547
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 9c6948b9026..9a190236586 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -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 {}; } |