Author: Kazu Hirata Date: 2021-12-17T18:19:25-08:00 New Revision: fee57711fe4a5578adc65bf9ebfe664905ff5309
URL: https://github.com/llvm/llvm-project/commit/fee57711fe4a5578adc65bf9ebfe664905ff5309 DIFF: https://github.com/llvm/llvm-project/commit/fee57711fe4a5578adc65bf9ebfe664905ff5309.diff LOG: Use DenseMap::lookup (NFC) Added: Modified: clang/lib/AST/ParentMap.cpp llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp llvm/lib/Transforms/IPO/SampleProfile.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/ParentMap.cpp b/clang/lib/AST/ParentMap.cpp index 2ff5c9d8aeb57..da21e573c3202 100644 --- a/clang/lib/AST/ParentMap.cpp +++ b/clang/lib/AST/ParentMap.cpp @@ -133,8 +133,7 @@ void ParentMap::setParent(const Stmt *S, const Stmt *Parent) { Stmt* ParentMap::getParent(Stmt* S) const { MapTy* M = (MapTy*) Impl; - MapTy::iterator I = M->find(S); - return I == M->end() ? nullptr : I->second; + return M->lookup(S); } Stmt *ParentMap::getParentIgnoreParens(Stmt *S) const { diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp index c123ea3cd2d5a..03dcd0f6d2c9c 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp @@ -83,7 +83,7 @@ void DAGTypeLegalizer::PerformExpensiveChecks() { SDValue Res(&Node, i); bool Failed = false; // Don't create a value in map. - auto ResId = (ValueToIdMap.count(Res)) ? ValueToIdMap[Res] : 0; + auto ResId = ValueToIdMap.lookup(Res); unsigned Mapped = 0; if (ResId && (ReplacedValues.find(ResId) != ReplacedValues.end())) { diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp index d57c504553a30..bc6051de90c4d 100644 --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -1159,11 +1159,9 @@ bool SampleProfileLoader::inlineHotFunctions( } for (CallBase *I : CIS) { Function *CalledFunction = I->getCalledFunction(); - InlineCandidate Candidate = { - I, - LocalNotInlinedCallSites.count(I) ? LocalNotInlinedCallSites[I] - : nullptr, - 0 /* dummy count */, 1.0 /* dummy distribution factor */}; + InlineCandidate Candidate = {I, LocalNotInlinedCallSites.lookup(I), + 0 /* dummy count */, + 1.0 /* dummy distribution factor */}; // Do not inline recursive calls. if (CalledFunction == &F) continue; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits