Skip to content

Commit 8e85b77

Browse files
[Analysis] Avoid repeated hash lookups (NFC) (#123446)
Co-authored-by: Nikita Popov <[email protected]>
1 parent 12f78e7 commit 8e85b77

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/Analysis/InlineCost.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2698,8 +2698,10 @@ void CallAnalyzer::findDeadBlocks(BasicBlock *CurrBB, BasicBlock *NextBB) {
26982698
auto IsEdgeDead = [&](BasicBlock *Pred, BasicBlock *Succ) {
26992699
// A CFG edge is dead if the predecessor is dead or the predecessor has a
27002700
// known successor which is not the one under exam.
2701-
return (DeadBlocks.count(Pred) ||
2702-
(KnownSuccessors[Pred] && KnownSuccessors[Pred] != Succ));
2701+
if (DeadBlocks.count(Pred))
2702+
return true;
2703+
BasicBlock *KnownSucc = KnownSuccessors[Pred];
2704+
return KnownSucc && KnownSucc != Succ;
27032705
};
27042706

27052707
auto IsNewlyDead = [&](BasicBlock *BB) {

0 commit comments

Comments
 (0)