[llvm] [LAA] Improve code in replaceSymbolicStrideSCEV (NFC) (PR #139532)
via llvm-commits
llvm-commits at lists.llvm.org
Mon May 12 03:55:25 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
Author: Ramkumar Ramachandra (artagnon)
<details>
<summary>Changes</summary>
Prefer DenseMap::lookup over DenseMap::find.
---
Full diff: https://github.com/llvm/llvm-project/pull/139532.diff
1 Files Affected:
- (modified) llvm/lib/Analysis/LoopAccessAnalysis.cpp (+2-3)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/139532
More information about the llvm-commits
mailing list