@@ -216,9 +216,7 @@ void LiveVariables::HandleVirtRegDef(Register Reg, MachineInstr &MI) {
216216// / FindLastPartialDef - Return the last partial def of the specified register.
217217// / Also returns the sub-registers that're defined by the instruction.
218218MachineInstr *
219- LiveVariables::FindLastPartialDef (Register Reg,
220- SmallSet<unsigned , 4 > &PartDefRegs) {
221- unsigned LastDefReg = 0 ;
219+ LiveVariables::FindLastPartialDef (Register Reg) {
222220 unsigned LastDefDist = 0 ;
223221 MachineInstr *LastDef = nullptr ;
224222 for (MCPhysReg SubReg : TRI->subregs (Reg)) {
@@ -227,7 +225,6 @@ LiveVariables::FindLastPartialDef(Register Reg,
227225 continue ;
228226 unsigned Dist = DistanceMap[Def];
229227 if (Dist > LastDefDist) {
230- LastDefReg = SubReg;
231228 LastDef = Def;
232229 LastDefDist = Dist;
233230 }
@@ -236,16 +233,6 @@ LiveVariables::FindLastPartialDef(Register Reg,
236233 if (!LastDef)
237234 return nullptr ;
238235
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- }
249236 return LastDef;
250237}
251238
@@ -264,30 +251,11 @@ void LiveVariables::HandlePhysRegUse(Register Reg, MachineInstr &MI) {
264251 // ...
265252 // = EAX
266253 // 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);
269255 // If LastPartialDef is NULL, it must be using a livein register.
270256 if (LastPartialDef) {
271257 LastPartialDef->addOperand (MachineOperand::CreateReg (Reg, true /* IsDef*/ ,
272258 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- }
291259 }
292260 } else if (LastDef && !PhysRegUse[Reg] &&
293261 !LastDef->findRegisterDefOperand (Reg, /* TRI=*/ nullptr ))
0 commit comments