@@ -236,8 +236,7 @@ namespace {
236
236
// / was successfully coalesced away. If it is not currently possible to
237
237
// / coalesce this interval, but it may be possible if other things get
238
238
// / coalesced, then it returns true by reference in 'Again'.
239
- bool joinCopy (MachineInstr *CopyMI, bool &Again,
240
- SmallPtrSetImpl<MachineInstr *> &CurrentErasedInstrs);
239
+ bool joinCopy (MachineInstr *CopyMI, bool &Again);
241
240
242
241
// / Attempt to join these two intervals. On failure, this
243
242
// / returns false. The output "SrcInt" will not have been modified, so we
@@ -1965,9 +1964,7 @@ void RegisterCoalescer::setUndefOnPrunedSubRegUses(LiveInterval &LI,
1965
1964
LIS->shrinkToUses (&LI);
1966
1965
}
1967
1966
1968
- bool RegisterCoalescer::joinCopy (
1969
- MachineInstr *CopyMI, bool &Again,
1970
- SmallPtrSetImpl<MachineInstr *> &CurrentErasedInstrs) {
1967
+ bool RegisterCoalescer::joinCopy (MachineInstr *CopyMI, bool &Again) {
1971
1968
Again = false ;
1972
1969
LLVM_DEBUG (dbgs () << LIS->getInstructionIndex (*CopyMI) << ' \t ' << *CopyMI);
1973
1970
@@ -2159,9 +2156,7 @@ bool RegisterCoalescer::joinCopy(
2159
2156
// CopyMI has been erased by joinIntervals at this point. Remove it from
2160
2157
// ErasedInstrs since copyCoalesceWorkList() won't add a successful join back
2161
2158
// to the work list. This keeps ErasedInstrs from growing needlessly.
2162
- if (ErasedInstrs.erase (CopyMI))
2163
- // But we may encounter the instruction again in this iteration.
2164
- CurrentErasedInstrs.insert (CopyMI);
2159
+ ErasedInstrs.erase (CopyMI);
2165
2160
2166
2161
// Rewrite all SrcReg operands to DstReg.
2167
2162
// Also update DstReg operands to include DstIdx if it is set.
@@ -3987,33 +3982,21 @@ void RegisterCoalescer::lateLiveIntervalUpdate() {
3987
3982
bool RegisterCoalescer::
3988
3983
copyCoalesceWorkList (MutableArrayRef<MachineInstr*> CurrList) {
3989
3984
bool Progress = false ;
3990
- SmallPtrSet<MachineInstr *, 4 > CurrentErasedInstrs;
3991
3985
for (MachineInstr *&MI : CurrList) {
3992
3986
if (!MI)
3993
3987
continue ;
3994
3988
// Skip instruction pointers that have already been erased, for example by
3995
3989
// dead code elimination.
3996
- if (ErasedInstrs.count (MI) || CurrentErasedInstrs. count (MI) ) {
3990
+ if (ErasedInstrs.count (MI)) {
3997
3991
MI = nullptr ;
3998
3992
continue ;
3999
3993
}
4000
3994
bool Again = false ;
4001
- bool Success = joinCopy (MI, Again, CurrentErasedInstrs );
3995
+ bool Success = joinCopy (MI, Again);
4002
3996
Progress |= Success;
4003
3997
if (Success || !Again)
4004
3998
MI = nullptr ;
4005
3999
}
4006
- // Clear instructions not recorded in `ErasedInstrs` but erased.
4007
- if (!CurrentErasedInstrs.empty ()) {
4008
- for (MachineInstr *&MI : CurrList) {
4009
- if (MI && CurrentErasedInstrs.count (MI))
4010
- MI = nullptr ;
4011
- }
4012
- for (MachineInstr *&MI : WorkList) {
4013
- if (MI && CurrentErasedInstrs.count (MI))
4014
- MI = nullptr ;
4015
- }
4016
- }
4017
4000
return Progress;
4018
4001
}
4019
4002
0 commit comments