[llvm] [llvm] Migrate away from PointerUnion::dyn_cast (NFC) (PR #123692)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 00:17:36 PST 2025


================
@@ -3630,13 +3631,13 @@ IndexCallsiteContextGraph::cloneFunctionForCallsite(
   for (auto &Inst : CallsWithMetadataInFunc) {
     // This map always has the initial version in it.
     assert(Inst.cloneNo() == 0);
-    if (auto *AI = Inst.call().dyn_cast<AllocInfo *>()) {
+    if (auto *AI = dyn_cast_if_present<AllocInfo *>(Inst.call())) {
       assert(AI->Versions.size() == CloneNo);
       // We assign the allocation type later (in updateAllocationCall), just add
       // an entry for it here.
       AI->Versions.push_back(0);
     } else {
-      auto *CI = Inst.call().dyn_cast<CallsiteInfo *>();
+      auto *CI = dyn_cast_if_present<CallsiteInfo *>(Inst.call());
----------------
nikic wrote:

Can be cast<> which implies above can be dyn_cast<>.

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


More information about the llvm-commits mailing list