From 68908993ebd2af459cd0f2ed6ab340bf62fb3e9d Mon Sep 17 00:00:00 2001 From: Djordje Todorovic Date: Mon, 10 Feb 2020 09:49:14 +0100 Subject: [CSInfo] Use isCandidateForCallSiteEntry() when updating the CSInfo Use the isCandidateForCallSiteEntry(). This should mostly be an NFC, but there are some parts ensuring the moveCallSiteInfo() and copyCallSiteInfo() operate with call site entry candidates (both Src and Dest should be the call site entry candidates). Differential Revision: https://reviews.llvm.org/D74122 --- llvm/lib/CodeGen/MachineFunction.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'llvm/lib/CodeGen/MachineFunction.cpp') diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 10b6aa90370d..06b5ab5b7f4c 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -863,7 +863,8 @@ try_next:; MachineFunction::CallSiteInfoMap::iterator MachineFunction::getCallSiteInfo(const MachineInstr *MI) { - assert(MI->isCall() && "Call site info refers only to call instructions!"); + assert(MI->isCandidateForCallSiteEntry() && + "Call site info refers only to call (MI) candidates"); if (!Target.Options.EnableDebugEntryValues) return CallSitesInfo.end(); @@ -872,7 +873,11 @@ MachineFunction::getCallSiteInfo(const MachineInstr *MI) { void MachineFunction::moveCallSiteInfo(const MachineInstr *Old, const MachineInstr *New) { - assert(New->isCall() && "Call site info refers only to call instructions!"); + assert(Old->isCandidateForCallSiteEntry() && + "Call site info refers only to call (MI) candidates"); + + if (!New->isCandidateForCallSiteEntry()) + return eraseCallSiteInfo(Old); CallSiteInfoMap::iterator CSIt = getCallSiteInfo(Old); if (CSIt == CallSitesInfo.end()) @@ -884,6 +889,8 @@ void MachineFunction::moveCallSiteInfo(const MachineInstr *Old, } void MachineFunction::eraseCallSiteInfo(const MachineInstr *MI) { + assert(MI->isCandidateForCallSiteEntry() && + "Call site info refers only to call (MI) candidates"); CallSiteInfoMap::iterator CSIt = getCallSiteInfo(MI); if (CSIt == CallSitesInfo.end()) return; @@ -892,7 +899,11 @@ void MachineFunction::eraseCallSiteInfo(const MachineInstr *MI) { void MachineFunction::copyCallSiteInfo(const MachineInstr *Old, const MachineInstr *New) { - assert(New->isCall() && "Call site info refers only to call instructions!"); + assert(Old->isCandidateForCallSiteEntry() && + "Call site info refers only to call (MI) candidates"); + + if (!New->isCandidateForCallSiteEntry()) + return eraseCallSiteInfo(Old); CallSiteInfoMap::iterator CSIt = getCallSiteInfo(Old); if (CSIt == CallSitesInfo.end()) -- cgit v1.2.3