[llvm] [Analysis] Avoid repeated hash lookups (NFC) (PR #123446)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 17 21:00:37 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/123446.diff
1 Files Affected:
- (modified) llvm/lib/Analysis/InlineCost.cpp (+4-2)
``````````diff
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 85287a39f2caad..c77441d5d46bbd 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -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];
+ return KnownSucc && KnownSucc != Succ;
};
auto IsNewlyDead = [&](BasicBlock *BB) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/123446
More information about the llvm-commits
mailing list