Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Commit

Permalink
[OPENMP] Improve performance of the hasDSA() function, NFC.
Browse files Browse the repository at this point in the history
Remove some unneccesary code from the function after the fix for ASAN
buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301547 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
alexey-bataev committed Apr 27, 2017
1 parent 7b3b524 commit b6ac2f9
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions lib/Sema/SemaOpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
}

Expand Down

0 comments on commit b6ac2f9

Please sign in to comment.