summaryrefslogtreecommitdiffstats
path: root/llvm/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
commite057403835c0eac0dccd04f22ce9faafa4c17d4c (patch)
tree537915b3c6e49f20d79ab125cf73e76e77221472 /llvm/lib/CodeGen/RegAllocLocal.cpp
parentb0fe9b9a409053be683ed2af7af6c5800db0028a (diff)
downloadbcm5719-llvm-e057403835c0eac0dccd04f22ce9faafa4c17d4c.tar.gz
bcm5719-llvm-e057403835c0eac0dccd04f22ce9faafa4c17d4c.zip
Fix a case where debug_value could affect codegen.
llvm-svn: 94866
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocLocal.cpp')
-rw-r--r--llvm/lib/CodeGen/RegAllocLocal.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/RegAllocLocal.cpp b/llvm/lib/CodeGen/RegAllocLocal.cpp
index cbb5826ce9a..6a09bd98166 100644
--- a/llvm/lib/CodeGen/RegAllocLocal.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud