-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[LAA] Improve code in replaceSymbolicStrideSCEV (NFC) #139532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Prefer DenseMap::lookup over DenseMap::find.
@llvm/pr-subscribers-llvm-analysis Author: Ramkumar Ramachandra (artagnon) ChangesPrefer DenseMap::lookup over DenseMap::find. Full diff: https://github.com/llvm/llvm-project/pull/139532.diff 1 Files Affected:
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/116/builds/12706 Here is the relevant piece of the build log for the reference
|
Prefer DenseMap::lookup over DenseMap::find.