[llvm] c1e678b - [LAA] Improve code in replaceSymbolicStrideSCEV (NFC) (#139532)
via llvm-commits
llvm-commits at lists.llvm.org
Mon May 12 06:18:30 PDT 2025
Author: Ramkumar Ramachandra
Date: 2025-05-12T14:18:26+01:00
New Revision: c1e678b13403ac276b1d2e3bb12c0521f3c1b109
URL: https://github.com/llvm/llvm-project/commit/c1e678b13403ac276b1d2e3bb12c0521f3c1b109
DIFF: https://github.com/llvm/llvm-project/commit/c1e678b13403ac276b1d2e3bb12c0521f3c1b109.diff
LOG: [LAA] Improve code in replaceSymbolicStrideSCEV (NFC) (#139532)
Prefer DenseMap::lookup over DenseMap::find.
Added:
Modified:
llvm/lib/Analysis/LoopAccessAnalysis.cpp
Removed:
################################################################################
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<Value *, const SCEV *>::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
More information about the llvm-commits
mailing list