aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineOutliner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/MachineOutliner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineOutliner.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index 0f3ed8a..80a235a 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -1245,8 +1245,9 @@ bool MachineOutliner::outline(Module &M,
if (MBB.getParent()->getProperties().hasProperty(
MachineFunctionProperties::Property::TracksLiveness)) {
// Helper lambda for adding implicit def operands to the call
- // instruction.
- auto CopyDefs = [&CallInst](MachineInstr &MI) {
+ // instruction. It also updates call site information for moved
+ // code.
+ auto CopyDefsAndUpdateCalls = [&CallInst](MachineInstr &MI) {
for (MachineOperand &MOP : MI.operands()) {
// Skip over anything that isn't a register.
if (!MOP.isReg())
@@ -1258,13 +1259,16 @@ bool MachineOutliner::outline(Module &M,
MOP.getReg(), true, /* isDef = true */
true /* isImp = true */));
}
+ if (MI.isCall())
+ MI.getMF()->updateCallSiteInfo(&MI);
};
// Copy over the defs in the outlined range.
// First inst in outlined range <-- Anything that's defined in this
// ... .. range has to be added as an
// implicit Last inst in outlined range <-- def to the call
- // instruction.
- std::for_each(CallInst, std::next(EndIt), CopyDefs);
+ // instruction. Also remove call site information for outlined block
+ // of code.
+ std::for_each(CallInst, std::next(EndIt), CopyDefsAndUpdateCalls);
}
// Erase from the point after where the call was inserted up to, and