We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f8e855 commit 7d9f993Copy full SHA for 7d9f993
mlir/lib/Dialect/Transform/Transforms/CheckUses.cpp
@@ -39,11 +39,11 @@ template <typename FnTy>
39
const llvm::SmallPtrSet<Block *, 4> &
40
getReachableImpl(Block *block, FnTy getNextNodes,
41
DenseMap<Block *, llvm::SmallPtrSet<Block *, 4>> &cache) {
42
- auto it = cache.find(block);
43
- if (it != cache.end())
+ auto [it, inserted] = cache.try_emplace(block);
+ if (!inserted)
44
return it->getSecond();
45
46
- llvm::SmallPtrSet<Block *, 4> &reachable = cache[block];
+ llvm::SmallPtrSet<Block *, 4> &reachable = it->second;
47
SmallVector<Block *> worklist;
48
worklist.push_back(block);
49
while (!worklist.empty()) {
0 commit comments