Skip to content

Commit debe7bd

Browse files
[memprof] Migrate away from PointerUnion::dyn_cast (NFC) (#123716)
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 expect the arguments to be of the requested types. Note that all these cases have assert and/or dereferences just after cast, implying that the return value from cast must be nonnull. --------- Co-authored-by: Nikita Popov <[email protected]>
1 parent 81c0f30 commit debe7bd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3542,7 +3542,7 @@ void ModuleCallsiteContextGraph::updateAllocationCall(
35423542

35433543
void IndexCallsiteContextGraph::updateAllocationCall(CallInfo &Call,
35443544
AllocationType AllocType) {
3545-
auto *AI = Call.call().dyn_cast<AllocInfo *>();
3545+
auto *AI = cast<AllocInfo *>(Call.call());
35463546
assert(AI);
35473547
assert(AI->Versions.size() > Call.cloneNo());
35483548
AI->Versions[Call.cloneNo()] = (uint8_t)AllocType;
@@ -3560,7 +3560,7 @@ ModuleCallsiteContextGraph::getAllocationCallType(const CallInfo &Call) const {
35603560

35613561
AllocationType
35623562
IndexCallsiteContextGraph::getAllocationCallType(const CallInfo &Call) const {
3563-
const auto *AI = Call.call().dyn_cast<AllocInfo *>();
3563+
const auto *AI = cast<AllocInfo *>(Call.call());
35643564
assert(AI->Versions.size() > Call.cloneNo());
35653565
return (AllocationType)AI->Versions[Call.cloneNo()];
35663566
}
@@ -3579,7 +3579,7 @@ void ModuleCallsiteContextGraph::updateCall(CallInfo &CallerCall,
35793579

35803580
void IndexCallsiteContextGraph::updateCall(CallInfo &CallerCall,
35813581
FuncInfo CalleeFunc) {
3582-
auto *CI = CallerCall.call().dyn_cast<CallsiteInfo *>();
3582+
auto *CI = cast<CallsiteInfo *>(CallerCall.call());
35833583
assert(CI &&
35843584
"Caller cannot be an allocation which should not have profiled calls");
35853585
assert(CI->Clones.size() > CallerCall.cloneNo());
@@ -3630,13 +3630,13 @@ IndexCallsiteContextGraph::cloneFunctionForCallsite(
36303630
for (auto &Inst : CallsWithMetadataInFunc) {
36313631
// This map always has the initial version in it.
36323632
assert(Inst.cloneNo() == 0);
3633-
if (auto *AI = Inst.call().dyn_cast<AllocInfo *>()) {
3633+
if (auto *AI = dyn_cast<AllocInfo *>(Inst.call())) {
36343634
assert(AI->Versions.size() == CloneNo);
36353635
// We assign the allocation type later (in updateAllocationCall), just add
36363636
// an entry for it here.
36373637
AI->Versions.push_back(0);
36383638
} else {
3639-
auto *CI = Inst.call().dyn_cast<CallsiteInfo *>();
3639+
auto *CI = cast<CallsiteInfo *>(Inst.call());
36403640
assert(CI && CI->Clones.size() == CloneNo);
36413641
// We assign the clone number later (in updateCall), just add an entry for
36423642
// it here.

0 commit comments

Comments
 (0)