Skip to content

Commit c1e678b

Browse files
authored
[LAA] Improve code in replaceSymbolicStrideSCEV (NFC) (#139532)
Prefer DenseMap::lookup over DenseMap::find.
1 parent ed81a81 commit c1e678b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/lib/Analysis/LoopAccessAnalysis.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,11 @@ const SCEV *llvm::replaceSymbolicStrideSCEV(PredicatedScalarEvolution &PSE,
158158

159159
// If there is an entry in the map return the SCEV of the pointer with the
160160
// symbolic stride replaced by one.
161-
DenseMap<Value *, const SCEV *>::const_iterator SI = PtrToStride.find(Ptr);
162-
if (SI == PtrToStride.end())
161+
const SCEV *StrideSCEV = PtrToStride.lookup(Ptr);
162+
if (!StrideSCEV)
163163
// For a non-symbolic stride, just return the original expression.
164164
return OrigSCEV;
165165

166-
const SCEV *StrideSCEV = SI->second;
167166
// Note: This assert is both overly strong and overly weak. The actual
168167
// invariant here is that StrideSCEV should be loop invariant. The only
169168
// such invariant strides we happen to speculate right now are unknowns

0 commit comments

Comments
 (0)