aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocLinearScan.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/RegAllocLinearScan.cpp')
-rw-r--r--lib/CodeGen/RegAllocLinearScan.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp
index 41a42fd22d..2caa2f9d18 100644
--- a/lib/CodeGen/RegAllocLinearScan.cpp
+++ b/lib/CodeGen/RegAllocLinearScan.cpp
@@ -905,6 +905,17 @@ void RALinScan::assignRegOrStackSlotAtInterval(LiveInterval* cur)
DOUT << tri_->getName(physReg) << '\n';
// Note the register is not really in use.
vrm_->assignVirt2Phys(cur->reg, physReg);
+ // Since the register allocator is allowed to assign this virtual register
+ // physical register that overlaps other live intervals. Mark these
+ // operands as "Undef" which means later passes, e.g. register scavenger
+ // can ignore them.
+ for (MachineRegisterInfo::reg_iterator RI = mri_->reg_begin(cur->reg),
+ RE = mri_->reg_end(); RI != RE; ++RI) {
+ MachineOperand &MO = RI.getOperand();
+ MO.setIsUndef();
+ if (MO.isKill())
+ MO.setIsKill(false);
+ }
return;
}