@@ -216,9 +216,7 @@ void LiveVariables::HandleVirtRegDef(Register Reg, MachineInstr &MI) {
216
216
// / FindLastPartialDef - Return the last partial def of the specified register.
217
217
// / Also returns the sub-registers that're defined by the instruction.
218
218
MachineInstr *
219
- LiveVariables::FindLastPartialDef (Register Reg,
220
- SmallSet<unsigned , 4 > &PartDefRegs) {
221
- unsigned LastDefReg = 0 ;
219
+ LiveVariables::FindLastPartialDef (Register Reg) {
222
220
unsigned LastDefDist = 0 ;
223
221
MachineInstr *LastDef = nullptr ;
224
222
for (MCPhysReg SubReg : TRI->subregs (Reg)) {
@@ -227,7 +225,6 @@ LiveVariables::FindLastPartialDef(Register Reg,
227
225
continue ;
228
226
unsigned Dist = DistanceMap[Def];
229
227
if (Dist > LastDefDist) {
230
- LastDefReg = SubReg;
231
228
LastDef = Def;
232
229
LastDefDist = Dist;
233
230
}
@@ -236,16 +233,6 @@ LiveVariables::FindLastPartialDef(Register Reg,
236
233
if (!LastDef)
237
234
return nullptr ;
238
235
239
- PartDefRegs.insert (LastDefReg);
240
- for (MachineOperand &MO : LastDef->all_defs ()) {
241
- if (MO.getReg () == 0 )
242
- continue ;
243
- Register DefReg = MO.getReg ();
244
- if (TRI->isSubRegister (Reg, DefReg)) {
245
- for (MCPhysReg SubReg : TRI->subregs_inclusive (DefReg))
246
- PartDefRegs.insert (SubReg);
247
- }
248
- }
249
236
return LastDef;
250
237
}
251
238
@@ -264,30 +251,11 @@ void LiveVariables::HandlePhysRegUse(Register Reg, MachineInstr &MI) {
264
251
// ...
265
252
// = EAX
266
253
// All of the sub-registers must have been defined before the use of Reg!
267
- SmallSet<unsigned , 4 > PartDefRegs;
268
- MachineInstr *LastPartialDef = FindLastPartialDef (Reg, PartDefRegs);
254
+ MachineInstr *LastPartialDef = FindLastPartialDef (Reg);
269
255
// If LastPartialDef is NULL, it must be using a livein register.
270
256
if (LastPartialDef) {
271
257
LastPartialDef->addOperand (MachineOperand::CreateReg (Reg, true /* IsDef*/ ,
272
258
true /* IsImp*/ ));
273
- PhysRegDef[Reg] = LastPartialDef;
274
- SmallSet<unsigned , 8 > Processed;
275
- for (MCPhysReg SubReg : TRI->subregs (Reg)) {
276
- if (Processed.count (SubReg))
277
- continue ;
278
- if (PartDefRegs.count (SubReg))
279
- continue ;
280
-
281
- // Check if SubReg is defined at LastPartialDef.
282
- bool IsDefinedHere = LastPartialDef->modifiesRegister (SubReg, TRI);
283
- // This part of Reg was defined before the last partial def. It's killed
284
- // here.
285
- LastPartialDef->addOperand (
286
- MachineOperand::CreateReg (SubReg, IsDefinedHere, true /* IsImp*/ ));
287
- PhysRegDef[SubReg] = LastPartialDef;
288
- for (MCPhysReg SS : TRI->subregs (SubReg))
289
- Processed.insert (SS);
290
- }
291
259
}
292
260
} else if (LastDef && !PhysRegUse[Reg] &&
293
261
!LastDef->findRegisterDefOperand (Reg, /* TRI=*/ nullptr ))
0 commit comments