diff options
Diffstat (limited to 'clang/lib/CodeGen/CGOpenMPRuntime.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntime.cpp | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 514457d9e4a..b48c52dbc1e 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -11044,41 +11044,11 @@ bool checkContext<OMPDeclareVariantAttr::CtxSetImplementation, } static bool greaterCtxScore(ASTContext &Ctx, const Expr *LHS, const Expr *RHS) { - // If both scores are unknown, choose the very first one. - if (!LHS && !RHS) - return true; - // If only one is known, return this one. - if (LHS && !RHS) - return true; - if (!LHS && RHS) - return false; llvm::APSInt LHSVal = LHS->EvaluateKnownConstInt(Ctx); llvm::APSInt RHSVal = RHS->EvaluateKnownConstInt(Ctx); return llvm::APSInt::compareValues(LHSVal, RHSVal) >= 0; } -namespace { -/// Comparator for the priority queue for context selector. -class OMPDeclareVariantAttrComparer - : public std::greater<const OMPDeclareVariantAttr *> { -private: - ASTContext &Ctx; - -public: - OMPDeclareVariantAttrComparer(ASTContext &Ctx) : Ctx(Ctx) {} - bool operator()(const OMPDeclareVariantAttr *LHS, - const OMPDeclareVariantAttr *RHS) const { - const Expr *LHSExpr = nullptr; - const Expr *RHSExpr = nullptr; - if (LHS->getCtxScore() == OMPDeclareVariantAttr::ScoreSpecified) - LHSExpr = LHS->getScore(); - if (RHS->getCtxScore() == OMPDeclareVariantAttr::ScoreSpecified) - RHSExpr = RHS->getScore(); - return greaterCtxScore(Ctx, LHSExpr, RHSExpr); - } -}; -} // anonymous namespace - /// Finds the variant function that matches current context with its context /// selector. static const FunctionDecl *getDeclareVariantFunction(ASTContext &Ctx, @@ -11088,13 +11058,7 @@ static const FunctionDecl *getDeclareVariantFunction(ASTContext &Ctx, // Iterate through all DeclareVariant attributes and check context selectors. auto &&Comparer = [&Ctx](const OMPDeclareVariantAttr *LHS, const OMPDeclareVariantAttr *RHS) { - const Expr *LHSExpr = nullptr; - const Expr *RHSExpr = nullptr; - if (LHS->getCtxScore() == OMPDeclareVariantAttr::ScoreSpecified) - LHSExpr = LHS->getScore(); - if (RHS->getCtxScore() == OMPDeclareVariantAttr::ScoreSpecified) - RHSExpr = RHS->getScore(); - return greaterCtxScore(Ctx, LHSExpr, RHSExpr); + return greaterCtxScore(Ctx, LHS->getScore(), RHS->getScore()); }; const OMPDeclareVariantAttr *TopMostAttr = nullptr; for (const auto *A : FD->specific_attrs<OMPDeclareVariantAttr>()) { |