17
17
#include " SystemZInstrInfo.h"
18
18
#include " SystemZSubtarget.h"
19
19
#include " llvm/ADT/Statistic.h"
20
- #include " llvm/CodeGen/LivePhysRegs .h"
20
+ #include " llvm/CodeGen/LiveRegUnits .h"
21
21
#include " llvm/CodeGen/MachineFunctionPass.h"
22
22
#include " llvm/CodeGen/MachineInstrBuilder.h"
23
23
using namespace llvm ;
@@ -161,7 +161,8 @@ bool SystemZPostRewrite::expandCondMove(MachineBasicBlock &MBB,
161
161
assert (DestReg == MI.getOperand (1 ).getReg () &&
162
162
" Expected destination and first source operand to be the same." );
163
163
164
- LivePhysRegs LiveRegs (TII->getRegisterInfo ());
164
+ const TargetRegisterInfo &TRI = TII->getRegisterInfo ();
165
+ LiveRegUnits LiveRegs (TRI);
165
166
LiveRegs.addLiveOuts (MBB);
166
167
for (auto I = std::prev (MBB.end ()); I != MBBI; --I)
167
168
LiveRegs.stepBackward (*I);
@@ -171,15 +172,18 @@ bool SystemZPostRewrite::expandCondMove(MachineBasicBlock &MBB,
171
172
MF.insert (std::next (MachineFunction::iterator (MBB)), RestMBB);
172
173
RestMBB->splice (RestMBB->begin (), &MBB, MI, MBB.end ());
173
174
RestMBB->transferSuccessors (&MBB);
174
- for (MCPhysReg R : LiveRegs)
175
- RestMBB->addLiveIn (R);
175
+ const BitVector &BV = TRI.getAllocatableSet (MF);
176
+ for (Register Reg : BV.set_bits ())
177
+ if (!LiveRegs.available (Reg))
178
+ RestMBB->addLiveIn (Reg);
176
179
177
180
// Create a new block MoveMBB to hold the move instruction.
178
181
MachineBasicBlock *MoveMBB = MF.CreateMachineBasicBlock (BB);
179
182
MF.insert (std::next (MachineFunction::iterator (MBB)), MoveMBB);
180
183
MoveMBB->addLiveIn (SrcReg);
181
- for (MCPhysReg R : LiveRegs)
182
- MoveMBB->addLiveIn (R);
184
+ for (Register Reg : BV.set_bits ())
185
+ if (!LiveRegs.available (Reg))
186
+ MoveMBB->addLiveIn (Reg);
183
187
184
188
// At the end of MBB, create a conditional branch to RestMBB if the
185
189
// condition is false, otherwise fall through to MoveMBB.
0 commit comments