summaryrefslogtreecommitdiff
path: root/lib/CodeGen/VirtRegMap.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-09-11 01:02:12 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-09-11 01:02:12 +0000
commitd9c553f2622f751f9c474aa348e2f8b595d7d9ca (patch)
tree8c9f618696aec433f56ffb0f64f47fa09e4c0313 /lib/CodeGen/VirtRegMap.cpp
parent7f85fbd9de5a4bb1474075b46eb3a8246ea5220d (diff)
downloadllvm-d9c553f2622f751f9c474aa348e2f8b595d7d9ca.tar.gz
llvm-d9c553f2622f751f9c474aa348e2f8b595d7d9ca.tar.bz2
llvm-d9c553f2622f751f9c474aa348e2f8b595d7d9ca.tar.xz
Propagate subreg index when promoting a load to a copy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56085 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/VirtRegMap.cpp')
-rw-r--r--lib/CodeGen/VirtRegMap.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/VirtRegMap.cpp b/lib/CodeGen/VirtRegMap.cpp
index e783e04a61..3e27fe2793 100644
--- a/lib/CodeGen/VirtRegMap.cpp
+++ b/lib/CodeGen/VirtRegMap.cpp
@@ -1588,11 +1588,18 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM) {
if (DestReg != InReg) {
const TargetRegisterClass *RC = RegInfo->getRegClass(VirtReg);
TII->copyRegToReg(MBB, &MI, DestReg, InReg, RC, RC);
+ MachineOperand *DefMO = MI.findRegisterDefOperand(DestReg);
+ unsigned SubIdx = DefMO->getSubReg();
// Revisit the copy so we make sure to notice the effects of the
// operation on the destreg (either needing to RA it if it's
// virtual or needing to clobber any values if it's physical).
NextMII = &MI;
--NextMII; // backtrack to the copy.
+ // Propagate the sub-register index over.
+ if (SubIdx) {
+ DefMO = NextMII->findRegisterDefOperand(DestReg);
+ DefMO->setSubReg(SubIdx);
+ }
BackTracked = true;
} else {
DOUT << "Removing now-noop copy: " << MI;