[llvm] r290759 - [LVI] Manually hoist computation from loop
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 30 09:56:47 PST 2016
Author: reames
Date: Fri Dec 30 11:56:47 2016
New Revision: 290759
URL: http://llvm.org/viewvc/llvm-project?rev=290759&view=rev
Log:
[LVI] Manually hoist computation from loop
Minor compile time win. Not known to be a hot spot, just something I noticed while reading.
Modified:
llvm/trunk/lib/Analysis/LazyValueInfo.cpp
Modified: llvm/trunk/lib/Analysis/LazyValueInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyValueInfo.cpp?rev=290759&r1=290758&r2=290759&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyValueInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyValueInfo.cpp Fri Dec 30 11:56:47 2016
@@ -525,23 +525,28 @@ void LazyValueInfoCache::threadEdgeImpl(
// Skip blocks only accessible through NewSucc.
if (ToUpdate == NewSucc) continue;
+ // If a value was marked overdefined in OldSucc, and is here too...
+ auto OI = OverDefinedCache.find(ToUpdate);
+ if (OI == OverDefinedCache.end())
+ continue;
+ SmallPtrSetImpl<Value *> &ValueSet = OI->second;
+
bool changed = false;
for (Value *V : ValsToClear) {
- // If a value was marked overdefined in OldSucc, and is here too...
- auto OI = OverDefinedCache.find(ToUpdate);
- if (OI == OverDefinedCache.end())
- continue;
- SmallPtrSetImpl<Value *> &ValueSet = OI->second;
+ // TODO: count and erase can be converted to a find/erase(itr) pattern
if (!ValueSet.count(V))
continue;
ValueSet.erase(V);
- if (ValueSet.empty())
- OverDefinedCache.erase(OI);
// If we removed anything, then we potentially need to update
// blocks successors too.
changed = true;
+
+ if (ValueSet.empty()) {
+ OverDefinedCache.erase(OI);
+ break;
+ }
}
if (!changed) continue;
More information about the llvm-commits
mailing list