summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorWolfgang Pieb <Wolfgang.Pieb@sony.com>2016-08-16 17:12:50 +0000
committerWolfgang Pieb <Wolfgang.Pieb@sony.com>2016-08-16 17:12:50 +0000
commit8df58f48dd6ec9735e52867d92db2f70dfbaa2cc (patch)
tree2ef8f6601d92373caea2eb86576d8ce7e68c15ea /llvm/lib/CodeGen
parentdb68c9adbdc2ef9e15d1f24d879ab79910f6bcd1 (diff)
downloadbcm5719-llvm-8df58f48dd6ec9735e52867d92db2f70dfbaa2cc.tar.gz
bcm5719-llvm-8df58f48dd6ec9735e52867d92db2f70dfbaa2cc.zip
When the inline spiller rematerializes an instruction, take the debug location from the instruction
that immediately follows the rematerialization point. Patch by Andrea DiBiagio. Differential Revision: http://reviews.llvm.org/D23539 llvm-svn: 278822
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/InlineSpiller.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/InlineSpiller.cpp b/llvm/lib/CodeGen/InlineSpiller.cpp
index 1dd028f4bce..15f77c620c7 100644
--- a/llvm/lib/CodeGen/InlineSpiller.cpp
+++ b/llvm/lib/CodeGen/InlineSpiller.cpp
@@ -550,12 +550,18 @@ bool InlineSpiller::reMaterializeFor(LiveInterval &VirtReg, MachineInstr &MI) {
return true;
}
- // Alocate a new register for the remat.
+ // Allocate a new register for the remat.
unsigned NewVReg = Edit->createFrom(Original);
// Finally we can rematerialize OrigMI before MI.
SlotIndex DefIdx =
Edit->rematerializeAt(*MI.getParent(), MI, NewVReg, RM, TRI);
+
+ // We take the DebugLoc from MI, since OrigMI may be attributed to a
+ // different source location.
+ auto *NewMI = LIS.getInstructionFromIndex(DefIdx);
+ NewMI->setDebugLoc(MI.getDebugLoc());
+
(void)DefIdx;
DEBUG(dbgs() << "\tremat: " << DefIdx << '\t'
<< *LIS.getInstructionFromIndex(DefIdx));
OpenPOWER on IntegriCloud