diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-05-20 04:52:48 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-05-20 04:52:48 +0000 |
commit | f0bf8b401827b58ec171c9d994c46d7f810a3e17 (patch) | |
tree | f9b94f7778b3fbf0b67799b3001584497b349bc6 | |
parent | 067fcb4087a2c816f6536907b9918165e5b00b33 (diff) |
Avoid deleting extra copies when RegistersDefinedFromSameValue is true.
This function adds copies to be erased to DupCopies, avoid also adding
them to DeadCopies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157147 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/RegisterCoalescer.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp index f529f1899c..149b6b751f 100644 --- a/lib/CodeGen/RegisterCoalescer.cpp +++ b/lib/CodeGen/RegisterCoalescer.cpp @@ -1310,9 +1310,10 @@ bool RegisterCoalescer::joinIntervals(CoalescerPair &CP) { // DstReg is known to be a register in the LHS interval. If the src is // from the RHS interval, we can use its value #. - if (!CP.isCoalescable(MI) && - !RegistersDefinedFromSameValue(*LIS, *TRI, CP, VNI, OtherVNI, - DupCopies)) + if (CP.isCoalescable(MI)) + DeadCopies.push_back(MI); + else if (!RegistersDefinedFromSameValue(*LIS, *TRI, CP, VNI, OtherVNI, + DupCopies)) continue; LHSValsDefinedFromRHS[VNI] = OtherVNI; @@ -1339,13 +1340,13 @@ bool RegisterCoalescer::joinIntervals(CoalescerPair &CP) { // DstReg is known to be a register in the RHS interval. If the src is // from the LHS interval, we can use its value #. - if (!CP.isCoalescable(MI) && - !RegistersDefinedFromSameValue(*LIS, *TRI, CP, VNI, OtherVNI, - DupCopies)) + if (CP.isCoalescable(MI)) + DeadCopies.push_back(MI); + else if (!RegistersDefinedFromSameValue(*LIS, *TRI, CP, VNI, OtherVNI, + DupCopies)) continue; RHSValsDefinedFromLHS[VNI] = OtherVNI; - DeadCopies.push_back(MI); } LHSValNoAssignments.resize(LHS.getNumValNums(), -1); |