[llvm] [LV] Prefer DenseMap::lookup over find (NFC) (PR #141809)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 2 07:10:28 PDT 2025


================
@@ -2566,9 +2566,9 @@ static Value *getExpandedStep(const InductionDescriptor &ID,
     return C->getValue();
   if (auto *U = dyn_cast<SCEVUnknown>(Step))
     return U->getValue();
-  auto I = ExpandedSCEVs.find(Step);
-  assert(I != ExpandedSCEVs.end() && "SCEV must be expanded at this point");
-  return I->second;
+  auto *V = ExpandedSCEVs.lookup(Step);
----------------
david-arm wrote:

Yeah I noticed that when looking at the code. I guess it's just the difference between comparing iterators and comparing a default-constructed pointer with 0, and the latter seems neater for this case because the object is a simple type.

https://github.com/llvm/llvm-project/pull/141809


More information about the llvm-commits mailing list