[llvm] [Analysis] Avoid repeated hash lookups (NFC) (PR #123446)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 18 00:41:21 PST 2025


================
@@ -2698,8 +2698,10 @@ void CallAnalyzer::findDeadBlocks(BasicBlock *CurrBB, BasicBlock *NextBB) {
   auto IsEdgeDead = [&](BasicBlock *Pred, BasicBlock *Succ) {
     // A CFG edge is dead if the predecessor is dead or the predecessor has a
     // known successor which is not the one under exam.
-    return (DeadBlocks.count(Pred) ||
-            (KnownSuccessors[Pred] && KnownSuccessors[Pred] != Succ));
+    if (DeadBlocks.count(Pred))
+      return true;
+    auto *KnownSucc = KnownSuccessors[Pred];
----------------
nikic wrote:

```suggestion
    BasicBlock *KnownSucc = KnownSuccessors[Pred];
```

https://github.com/llvm/llvm-project/pull/123446


More information about the llvm-commits mailing list