From 3bb34c33834b937a99fbfcbbf95c00597f356913 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Tue, 18 Mar 2025 12:32:13 -0700 Subject: [PATCH] [Scalar] Avoid repeated hash lookups (NFC) --- llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp index c7b55c2fb4f45..68c079373e556 100644 --- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -1138,13 +1138,12 @@ static Value *findBasePointer(Value *I, DefiningValueMapTy &Cache, auto getBaseForInput = [&](Value *Input, Instruction *InsertPt) { Value *BDV = findBaseOrBDV(Input, Cache, KnownBases); Value *Base = nullptr; - if (!States.count(BDV)) { + if (auto It = States.find(BDV); It == States.end()) { assert(areBothVectorOrScalar(BDV, Input)); Base = BDV; } else { // Either conflict or base. - assert(States.count(BDV)); - Base = States[BDV].getBaseValue(); + Base = It->second.getBaseValue(); } assert(Base && "Can't be null"); // The cast is needed since base traversal may strip away bitcasts