summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/LazyValueInfo.cpp
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2016-12-30 17:56:47 +0000
committerPhilip Reames <listmail@philipreames.com>2016-12-30 17:56:47 +0000
commit1e48efcfc5275f9393f1c2622183dcecd97b1264 (patch)
tree45d6b701783027a061870ec40f9db14d4278c1d3 /llvm/lib/Analysis/LazyValueInfo.cpp
parent3c5a60329bd0e29d303788611f87e7b15258c4b6 (diff)
downloadbcm5719-llvm-1e48efcfc5275f9393f1c2622183dcecd97b1264.tar.gz
bcm5719-llvm-1e48efcfc5275f9393f1c2622183dcecd97b1264.zip
[LVI] Manually hoist computation from loop
Minor compile time win. Not known to be a hot spot, just something I noticed while reading. llvm-svn: 290759
Diffstat (limited to 'llvm/lib/Analysis/LazyValueInfo.cpp')
-rw-r--r--llvm/lib/Analysis/LazyValueInfo.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp
index e51e8217360..cd1f25090d6 100644
--- a/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/llvm/lib/Analysis/LazyValueInfo.cpp
@@ -525,23 +525,28 @@ void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc,
// 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;
OpenPOWER on IntegriCloud