[llvm] [memprof] Migrate away from PointerUnion::is (NFC) (PR #122622)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 11 17:04:10 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/122622
Note that PointerUnion::is have 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>
In this patch, I'm calling call().getBase() for an instance of
PointerUnion. call() alone would return an instance of IndexCall,
which wraps PointerUnion. Note that isa<> cannot directly accept an
instance of IndexCall, at least without defining CastInfo.
I'm not touching PointerUnion::dyn_cast for now because it's a bit
complicated; we could blindly migrate it to dyn_cast_if_present, but
we should probably use dyn_cast when the operand is known to be
non-null.
>From 3730932468ea04cc326eb0f0a11f6a7222cd3ac9 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 11 Jan 2025 13:36:40 -0800
Subject: [PATCH] [memprof] Migrate away from PointerUnion::is (NFC)
Note that PointerUnion::is have 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>
In this patch, I'm calling call().getBase() for an instance of
PointerUnion. call() alone would return an instance of IndexCall,
which wraps PointerUnion. Note that isa<> cannot directly accept an
instance of IndexCall, at least without defining CastInfo.
I'm not touching PointerUnion::dyn_cast for now because it's a bit
complicated; we could blindly migrate it to dyn_cast_if_present, but
we should probably use dyn_cast when the operand is known to be
non-null.
---
llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
index 3d0e5cb5f97b4f..61a8f4a448bbd7 100644
--- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
+++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
@@ -3610,7 +3610,7 @@ IndexCallsiteContextGraph::cloneFunctionForCallsite(
// Confirm this matches the CloneNo provided by the caller, which is based on
// the number of function clones we have.
assert(CloneNo ==
- (Call.call().is<AllocInfo *>()
+ (isa<AllocInfo *>(Call.call().getBase())
? Call.call().dyn_cast<AllocInfo *>()->Versions.size()
: Call.call().dyn_cast<CallsiteInfo *>()->Clones.size()));
// Walk all the instructions in this function. Create a new version for
More information about the llvm-commits
mailing list