[llvm] 3e7d47d - FunctionAttrs: Remove redundant cast to Instruction (#179907)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 5 03:25:40 PST 2026
Author: Matt Arsenault
Date: 2026-02-05T11:25:35Z
New Revision: 3e7d47d6b510b2ed3c0eea7992ad9df6907c1a19
URL: https://github.com/llvm/llvm-project/commit/3e7d47d6b510b2ed3c0eea7992ad9df6907c1a19
DIFF: https://github.com/llvm/llvm-project/commit/3e7d47d6b510b2ed3c0eea7992ad9df6907c1a19.diff
LOG: FunctionAttrs: Remove redundant cast to Instruction (#179907)
No point in casting to Instruction before casting to CallBase.
Added:
Modified:
llvm/lib/Transforms/IPO/FunctionAttrs.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index 50130da01c7ba..855692db006f9 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -2394,10 +2394,7 @@ static bool addNoRecurseAttrsTopDown(Function &F) {
// also detects if F is directly recursive as F is not yet marked as
// a norecurse function.
for (auto &U : F.uses()) {
- auto *I = dyn_cast<Instruction>(U.getUser());
- if (!I)
- return false;
- CallBase *CB = dyn_cast<CallBase>(I);
+ const CallBase *CB = dyn_cast<CallBase>(U.getUser());
if (!CB || !CB->isCallee(&U) ||
!CB->getParent()->getParent()->doesNotRecurse())
return false;
More information about the llvm-commits
mailing list