From b98031fd009447e5b85454a5d54fc9188b7a0767 Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Mon, 12 May 2025 11:47:51 +0100 Subject: [PATCH] [LAA] Improve code in replaceSymbolicStrideSCEV (NFC) Prefer DenseMap::lookup over DenseMap::find. --- llvm/lib/Analysis/LoopAccessAnalysis.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index 438669df51f89..f4e1d632b4d7d 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -158,12 +158,11 @@ const SCEV *llvm::replaceSymbolicStrideSCEV(PredicatedScalarEvolution &PSE, // If there is an entry in the map return the SCEV of the pointer with the // symbolic stride replaced by one. - DenseMap::const_iterator SI = PtrToStride.find(Ptr); - if (SI == PtrToStride.end()) + const SCEV *StrideSCEV = PtrToStride.lookup(Ptr); + if (!StrideSCEV) // For a non-symbolic stride, just return the original expression. return OrigSCEV; - const SCEV *StrideSCEV = SI->second; // Note: This assert is both overly strong and overly weak. The actual // invariant here is that StrideSCEV should be loop invariant. The only // such invariant strides we happen to speculate right now are unknowns