@@ -133,7 +133,6 @@ void llvm::finalizeBundle(MachineBasicBlock &MBB,
133
133
SmallSetVector<Register, 32 > LocalDefs;
134
134
BitVector LocalDefsP (TRI->getNumRegUnits ());
135
135
SmallSet<Register, 8 > DeadDefSet;
136
- SmallSet<Register, 16 > KilledDefSet;
137
136
SmallSetVector<Register, 8 > ExternUses;
138
137
SmallSet<Register, 8 > KilledUseSet;
139
138
SmallSet<Register, 8 > UndefUseSet;
@@ -151,7 +150,7 @@ void llvm::finalizeBundle(MachineBasicBlock &MBB,
151
150
MO.setIsInternalRead ();
152
151
if (MO.isKill ()) {
153
152
// Internal def is now killed.
154
- KilledDefSet .insert (Reg);
153
+ DeadDefSet .insert (Reg);
155
154
}
156
155
} else {
157
156
if (ExternUses.insert (Reg)) {
@@ -171,19 +170,18 @@ void llvm::finalizeBundle(MachineBasicBlock &MBB,
171
170
continue ;
172
171
173
172
if (LocalDefs.insert (Reg)) {
174
- if (MO.isDead ())
175
- DeadDefSet.insert (Reg);
176
- else if (Reg.isPhysical ())
173
+ if (!MO.isDead () && Reg.isPhysical ()) {
177
174
for (MCRegUnit Unit : TRI->regunits (Reg.asMCReg ()))
178
175
LocalDefsP.set (Unit);
176
+ }
179
177
} else {
180
- // Re-defined inside the bundle, it's no longer killed.
181
- KilledDefSet.erase (Reg);
182
178
if (!MO.isDead ()) {
183
- // Previously defined but dead.
179
+ // Re- defined inside the bundle, it's no longer dead.
184
180
DeadDefSet.erase (Reg);
185
181
}
186
182
}
183
+ if (MO.isDead ())
184
+ DeadDefSet.insert (Reg);
187
185
}
188
186
189
187
// Set FrameSetup/FrameDestroy for the bundle. If any of the instructions
@@ -196,7 +194,7 @@ void llvm::finalizeBundle(MachineBasicBlock &MBB,
196
194
197
195
for (Register Reg : LocalDefs) {
198
196
// 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);
200
198
MIB.addReg (Reg, getDefRegState (true ) | getDeadRegState (isDead) |
201
199
getImplRegState (true ));
202
200
}
0 commit comments