[llvm] [memprof] Migrate away from PointerUnion::dyn_cast (NFC) (PR #124505)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 26 20:38:34 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:
// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa<T>, cast<T> and the llvm::dyn_cast<T>
Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses cast
because we know which alternative to expect in the ternary expression.
---
Full diff: https://github.com/llvm/llvm-project/pull/124505.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp (+3-4)
``````````diff
diff --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
index 1966ce29083716..03e2e7089202de 100644
--- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
+++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
@@ -3598,10 +3598,9 @@ IndexCallsiteContextGraph::cloneFunctionForCallsite(
// The next clone number is the current size of versions array.
// Confirm this matches the CloneNo provided by the caller, which is based on
// the number of function clones we have.
- assert(CloneNo ==
- (isa<AllocInfo *>(Call.call())
- ? Call.call().dyn_cast<AllocInfo *>()->Versions.size()
- : Call.call().dyn_cast<CallsiteInfo *>()->Clones.size()));
+ assert(CloneNo == (isa<AllocInfo *>(Call.call())
+ ? cast<AllocInfo *>(Call.call())->Versions.size()
+ : cast<CallsiteInfo *>(Call.call())->Clones.size()));
// Walk all the instructions in this function. Create a new version for
// each (by adding an entry to the Versions/Clones summary array), and copy
// over the version being called for the function clone being cloned here.
``````````
</details>
https://github.com/llvm/llvm-project/pull/124505
More information about the llvm-commits
mailing list