summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineFunction.cpp
diff options
context:
space:
mode:
authorNikola Prica <nikola.prica@rt-rk.com>2019-10-08 15:43:12 +0000
committerNikola Prica <nikola.prica@rt-rk.com>2019-10-08 15:43:12 +0000
commit98603a815308626fafdba930f69333da13ecc31e (patch)
tree3ea353dcf96d8e7c2543cef5c418e9e29a3a5a3c /llvm/lib/CodeGen/MachineFunction.cpp
parent41ff39605ea1c9278f6ff15208475f5f3c863f44 (diff)
downloadbcm5719-llvm-98603a815308626fafdba930f69333da13ecc31e.tar.gz
bcm5719-llvm-98603a815308626fafdba930f69333da13ecc31e.zip
[DebugInfo][If-Converter] Update call site info during the optimization
During the If-Converter optimization pay attention when copying or deleting call instructions in order to keep call site information in valid state. Reviewers: aprantl, vsk, efriedma Reviewed By: vsk, efriedma Differential Revision: https://reviews.llvm.org/D66955 llvm-svn: 374068
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp34
1 files changed, 25 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index 79380339cc2..7d2ee230ca9 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -835,20 +835,36 @@ void MachineFunction::addCodeViewHeapAllocSite(MachineInstr *I,
CodeViewHeapAllocSites.push_back(std::make_tuple(BeginLabel, EndLabel, DI));
}
-void MachineFunction::updateCallSiteInfo(const MachineInstr *Old,
- const MachineInstr *New) {
- if (!Target.Options.EnableDebugEntryValues || Old == New)
- return;
+void MachineFunction::moveCallSiteInfo(const MachineInstr *Old,
+ const MachineInstr *New) {
+ assert(New->isCall() && "Call site info refers only to call instructions!");
- assert(Old->isCall() && (!New || New->isCall()) &&
- "Call site info referes only to call instructions!");
- CallSiteInfoMap::iterator CSIt = CallSitesInfo.find(Old);
+ CallSiteInfoMap::iterator CSIt = getCallSiteInfo(Old);
if (CSIt == CallSitesInfo.end())
return;
+
CallSiteInfo CSInfo = std::move(CSIt->second);
CallSitesInfo.erase(CSIt);
- if (New)
- CallSitesInfo[New] = CSInfo;
+ CallSitesInfo[New] = CSInfo;
+}
+
+void MachineFunction::eraseCallSiteInfo(const MachineInstr *MI) {
+ CallSiteInfoMap::iterator CSIt = getCallSiteInfo(MI);
+ if (CSIt == CallSitesInfo.end())
+ return;
+ CallSitesInfo.erase(CSIt);
+}
+
+void MachineFunction::copyCallSiteInfo(const MachineInstr *Old,
+ const MachineInstr *New) {
+ assert(New->isCall() && "Call site info refers only to call instructions!");
+
+ CallSiteInfoMap::iterator CSIt = getCallSiteInfo(Old);
+ if (CSIt == CallSitesInfo.end())
+ return;
+
+ CallSiteInfo CSInfo = CSIt->second;
+ CallSitesInfo[New] = CSInfo;
}
/// \}
OpenPOWER on IntegriCloud