diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-05-19 05:25:53 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-05-19 05:25:53 +0000 |
commit | 3662f0d492533435c30969118fd025f6bed46654 (patch) | |
tree | c97ab85c1c1c2ea7944de9ec63af34b8eec2ab11 /lib/CodeGen/RegisterCoalescer.cpp | |
parent | bd6f44a3a2a1404721bcbb67edf92b8480a3e655 (diff) |
Immediately erase trivially useless copies.
There is no need for these instructions to stick around since they are
known to be not dead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157102 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegisterCoalescer.cpp')
-rw-r--r-- | lib/CodeGen/RegisterCoalescer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp index 84fd590f26..0dbc7b6c65 100644 --- a/lib/CodeGen/RegisterCoalescer.cpp +++ b/lib/CodeGen/RegisterCoalescer.cpp @@ -1070,15 +1070,17 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { // If they are already joined we continue. if (CP.getSrcReg() == CP.getDstReg()) { - markAsJoined(CopyMI); DEBUG(dbgs() << "\tCopy already coalesced.\n"); + LIS->RemoveMachineInstrFromMaps(CopyMI); + CopyMI->eraseFromParent(); return false; // Not coalescable. } // Eliminate undefs. if (!CP.isPhys() && eliminateUndefCopy(CopyMI, CP)) { - markAsJoined(CopyMI); DEBUG(dbgs() << "\tEliminated copy of <undef> value.\n"); + LIS->RemoveMachineInstrFromMaps(CopyMI); + CopyMI->eraseFromParent(); return false; // Not coalescable. } |