summaryrefslogtreecommitdiffstats
path: root/llvm/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
commitb401449cebcd6cfae9ccc9fa552b85723d908e25 (patch)
treee7ea91869e40d5d1926ad476dd1ef47899548e4e /llvm/lib/CodeGen/VirtRegMap.cpp
parentce05c8eb49d6216ae1e2c12dcd9114d9515d6e8f (diff)
downloadbcm5719-llvm-b401449cebcd6cfae9ccc9fa552b85723d908e25.tar.gz
bcm5719-llvm-b401449cebcd6cfae9ccc9fa552b85723d908e25.zip
Propagate subreg index when promoting a load to a copy.
llvm-svn: 56085
Diffstat (limited to 'llvm/lib/CodeGen/VirtRegMap.cpp')
-rw-r--r--llvm/lib/CodeGen/VirtRegMap.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/VirtRegMap.cpp b/llvm/lib/CodeGen/VirtRegMap.cpp
index e783e04a616..3e27fe27930 100644
--- a/llvm/lib/CodeGen/VirtRegMap.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud