@@ -133,7 +133,6 @@ void llvm::finalizeBundle(MachineBasicBlock &MBB,
133133 SmallSetVector<Register, 32 > LocalDefs;
134134 BitVector LocalDefsP (TRI->getNumRegUnits ());
135135 SmallSet<Register, 8 > DeadDefSet;
136- SmallSet<Register, 16 > KilledDefSet;
137136 SmallSetVector<Register, 8 > ExternUses;
138137 SmallSet<Register, 8 > KilledUseSet;
139138 SmallSet<Register, 8 > UndefUseSet;
@@ -151,7 +150,7 @@ void llvm::finalizeBundle(MachineBasicBlock &MBB,
151150 MO.setIsInternalRead ();
152151 if (MO.isKill ()) {
153152 // Internal def is now killed.
154- KilledDefSet .insert (Reg);
153+ DeadDefSet .insert (Reg);
155154 }
156155 } else {
157156 if (ExternUses.insert (Reg)) {
@@ -171,19 +170,18 @@ void llvm::finalizeBundle(MachineBasicBlock &MBB,
171170 continue ;
172171
173172 if (LocalDefs.insert (Reg)) {
174- if (MO.isDead ())
175- DeadDefSet.insert (Reg);
176- else if (Reg.isPhysical ())
173+ if (!MO.isDead () && Reg.isPhysical ()) {
177174 for (MCRegUnit Unit : TRI->regunits (Reg.asMCReg ()))
178175 LocalDefsP.set (Unit);
176+ }
179177 } else {
180- // Re-defined inside the bundle, it's no longer killed.
181- KilledDefSet.erase (Reg);
182178 if (!MO.isDead ()) {
183- // Previously defined but dead.
179+ // Re- defined inside the bundle, it's no longer dead.
184180 DeadDefSet.erase (Reg);
185181 }
186182 }
183+ if (MO.isDead ())
184+ DeadDefSet.insert (Reg);
187185 }
188186
189187 // Set FrameSetup/FrameDestroy for the bundle. If any of the instructions
@@ -196,7 +194,7 @@ void llvm::finalizeBundle(MachineBasicBlock &MBB,
196194
197195 for (Register Reg : LocalDefs) {
198196 // If it's not live beyond end of the bundle, mark it dead.
199- bool isDead = DeadDefSet.contains (Reg) || KilledDefSet. contains (Reg) ;
197+ bool isDead = DeadDefSet.contains (Reg);
200198 MIB.addReg (Reg, getDefRegState (true ) | getDeadRegState (isDead) |
201199 getImplRegState (true ));
202200 }
0 commit comments