diff options
author | Djordje Todorovic <djordje.todorovic@rt-rk.com> | 2019-06-27 13:10:29 +0000 |
---|---|---|
committer | Djordje Todorovic <djordje.todorovic@rt-rk.com> | 2019-06-27 13:10:29 +0000 |
commit | 71d3869f60c3c0df56086db26d534e603e7d6f78 (patch) | |
tree | dde2d8f056f4d2dd7174d5208edb5ef12d8b6433 /llvm/lib/CodeGen/TargetInstrInfo.cpp | |
parent | 79dc930c131cfd9f0104b9b9cd4a2c936ad40545 (diff) | |
download | bcm5719-llvm-71d3869f60c3c0df56086db26d534e603e7d6f78.tar.gz bcm5719-llvm-71d3869f60c3c0df56086db26d534e603e7d6f78.zip |
[Backend] Keep call site info valid through the backend
Handle call instruction replacements and deletions in order to preserve
valid state of the call site info of the MachineFunction.
NOTE: If the call site info is enabled for a new target, the assertion from
the MachineFunction::DeleteMachineInstr() should help to locate places
where the updateCallSiteInfo() should be called in order to preserve valid
state of the call site info.
([10/13] Introduce the debug entry values.)
Co-authored-by: Ananth Sowda <asowda@cisco.com>
Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com>
Co-authored-by: Ivan Baev <ibaev@cisco.com>
Differential Revision: https://reviews.llvm.org/D61062
llvm-svn: 364536
Diffstat (limited to 'llvm/lib/CodeGen/TargetInstrInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetInstrInfo.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/TargetInstrInfo.cpp b/llvm/lib/CodeGen/TargetInstrInfo.cpp index cc3012addf2..868617ffe14 100644 --- a/llvm/lib/CodeGen/TargetInstrInfo.cpp +++ b/llvm/lib/CodeGen/TargetInstrInfo.cpp @@ -137,8 +137,14 @@ TargetInstrInfo::ReplaceTailWithBranchTo(MachineBasicBlock::iterator Tail, // Save off the debug loc before erasing the instruction. DebugLoc DL = Tail->getDebugLoc(); - // Remove all the dead instructions from the end of MBB. - MBB->erase(Tail, MBB->end()); + // Update call site info and remove all the dead instructions + // from the end of MBB. + while (Tail != MBB->end()) { + auto MI = Tail++; + if (MI->isCall()) + MBB->getParent()->updateCallSiteInfo(&*MI); + MBB->erase(MI); + } // If MBB isn't immediately before MBB, insert a branch to it. if (++MachineFunction::iterator(MBB) != MachineFunction::iterator(NewDest)) |