aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-04-28 04:43:18 +0000
committerChris Lattner <sabre@nondot.org>2006-04-28 04:43:18 +0000
commitba1fc3daf757c8f880c3069eed20218c91f2c3a8 (patch)
treec256acd5539c83d36e2b3d98cc878cfacc6fed1e /lib
parentae74f555522298bef3be8a173163bf778d59adf9 (diff)
downloadexternal_llvm-ba1fc3daf757c8f880c3069eed20218c91f2c3a8.tar.gz
external_llvm-ba1fc3daf757c8f880c3069eed20218c91f2c3a8.tar.bz2
external_llvm-ba1fc3daf757c8f880c3069eed20218c91f2c3a8.zip
Mapping of physregs can make it so that the designated and input physregs are
the same. In this case, don't emit a noop copy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28008 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/VirtRegMap.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/CodeGen/VirtRegMap.cpp b/lib/CodeGen/VirtRegMap.cpp
index b30c61c838..f0dd40d1e1 100644
--- a/lib/CodeGen/VirtRegMap.cpp
+++ b/lib/CodeGen/VirtRegMap.cpp
@@ -611,6 +611,19 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, const VirtRegMap &VRM) {
DesignatedReg = ReusedOperands.GetRegForReload(DesignatedReg, &MI,
Spills, MaybeDeadStores);
+ // If the mapped designated register is actually the physreg we have
+ // incoming, we don't need to inserted a dead copy.
+ if (DesignatedReg == PhysReg) {
+ // If this stack slot value is already available, reuse it!
+ DEBUG(std::cerr << "Reusing SS#" << StackSlot << " from physreg "
+ << MRI->getName(PhysReg) << " for vreg"
+ << VirtReg
+ << " instead of reloading into same physreg.\n");
+ MI.SetMachineOperandReg(i, PhysReg);
+ ++NumReused;
+ continue;
+ }
+
const TargetRegisterClass* RC =
MBB.getParent()->getSSARegMap()->getRegClass(VirtReg);