File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -67,16 +67,13 @@ void GlobalDCEPass::ComputeDependencies(Value *V,
67
67
Deps.insert (GV);
68
68
} else if (auto *CE = dyn_cast<Constant>(V)) {
69
69
// Avoid walking the whole tree of a big ConstantExprs multiple times.
70
- auto Where = ConstantDependenciesCache.find (CE);
71
- if (Where != ConstantDependenciesCache.end ()) {
72
- auto const &K = Where->second ;
73
- Deps.insert (K.begin (), K.end ());
74
- } else {
75
- SmallPtrSetImpl<GlobalValue *> &LocalDeps = ConstantDependenciesCache[CE];
70
+ auto [Where, Inserted] = ConstantDependenciesCache.try_emplace (CE);
71
+ SmallPtrSetImpl<GlobalValue *> &LocalDeps = Where->second ;
72
+ if (Inserted) {
76
73
for (User *CEUser : CE->users ())
77
74
ComputeDependencies (CEUser, LocalDeps);
78
- Deps.insert (LocalDeps.begin (), LocalDeps.end ());
79
75
}
76
+ Deps.insert (LocalDeps.begin (), LocalDeps.end ());
80
77
}
81
78
}
82
79
You can’t perform that action at this time.
0 commit comments