aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/RegAllocLocal.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2010-01-30 00:57:47 +0000
committerDale Johannesen <dalej@apple.com>2010-01-30 00:57:47 +0000
commit3940d849787209a8e43682d61bf40fde9919a314 (patch)
tree267b82b80297a52d5a6f612888c8e2d974cc21c1 /lib/CodeGen/RegAllocLocal.cpp
parent86fd7ce104076afb4ec2776d4a7f639023c4ec09 (diff)
downloadexternal_llvm-3940d849787209a8e43682d61bf40fde9919a314.zip
external_llvm-3940d849787209a8e43682d61bf40fde9919a314.tar.gz
external_llvm-3940d849787209a8e43682d61bf40fde9919a314.tar.bz2
Fix a case where debug_value could affect codegen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94866 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocLocal.cpp')
-rw-r--r--lib/CodeGen/RegAllocLocal.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp
index cbb5826..6a09bd9 100644
--- a/lib/CodeGen/RegAllocLocal.cpp
+++ b/lib/CodeGen/RegAllocLocal.cpp
@@ -838,6 +838,18 @@ void RALocal::AllocateBasicBlock(MachineBasicBlock &MBB) {
}
}
+ // If a DEBUG_VALUE says something is located in a spilled register,
+ // change the DEBUG_VALUE to be undef, which prevents the register
+ // from being reloaded here. Doing that would change the generated
+ // code, unless another use immediately follows this instruction.
+ if (MI->getOpcode()==TargetInstrInfo::DEBUG_VALUE &&
+ MI->getNumOperands()==3 && MI->getOperand(0).isReg()) {
+ unsigned VirtReg = MI->getOperand(0).getReg();
+ if (VirtReg && TargetRegisterInfo::isVirtualRegister(VirtReg) &&
+ !getVirt2PhysRegMapSlot(VirtReg))
+ MI->getOperand(0).setReg(0U);
+ }
+
// Get the used operands into registers. This has the potential to spill
// incoming values if we are out of registers. Note that we completely
// ignore physical register uses here. We assume that if an explicit