@@ -256,11 +256,11 @@ Spiller *llvm::createInlineSpiller(MachineFunctionPass &Pass,
256256// This minimizes register pressure and maximizes the store-to-load distance for
257257// spill slots which can be important in tight loops.
258258
259- // / isFullCopyOf - If MI is a COPY to or from Reg, return the other register,
260- // / otherwise return 0.
261- static Register isCopyOf (const MachineInstr &MI, Register Reg,
262- const TargetInstrInfo &TII) {
263- if (!TII. isCopyInstr (MI ))
259+ // / If MI is a COPY to or from Reg, return the other register, otherwise return
260+ // / 0.
261+ static Register isCopyOf (const MachineInstr &MI, Register Reg) {
262+ assert (!MI. isBundled ());
263+ if (!MI. isCopy ( ))
264264 return Register ();
265265
266266 const MachineOperand &DstOp = MI.getOperand (0 );
@@ -277,10 +277,9 @@ static Register isCopyOf(const MachineInstr &MI, Register Reg,
277277}
278278
279279// / Check for a copy bundle as formed by SplitKit.
280- static Register isCopyOfBundle (const MachineInstr &FirstMI, Register Reg,
281- const TargetInstrInfo &TII) {
280+ static Register isCopyOfBundle (const MachineInstr &FirstMI, Register Reg) {
282281 if (!FirstMI.isBundled ())
283- return isCopyOf (FirstMI, Reg, TII );
282+ return isCopyOf (FirstMI, Reg);
284283
285284 assert (!FirstMI.isBundledWithPred () && FirstMI.isBundledWithSucc () &&
286285 " expected to see first instruction in bundle" );
@@ -289,12 +288,11 @@ static Register isCopyOfBundle(const MachineInstr &FirstMI, Register Reg,
289288 MachineBasicBlock::const_instr_iterator I = FirstMI.getIterator ();
290289 while (I->isBundledWithSucc ()) {
291290 const MachineInstr &MI = *I;
292- auto CopyInst = TII.isCopyInstr (MI);
293- if (!CopyInst)
291+ if (!MI.isCopy ())
294292 return Register ();
295293
296- const MachineOperand &DstOp = *CopyInst-> Destination ;
297- const MachineOperand &SrcOp = *CopyInst-> Source ;
294+ const MachineOperand &DstOp = MI. getOperand ( 0 ) ;
295+ const MachineOperand &SrcOp = MI. getOperand ( 1 ) ;
298296 if (DstOp.getReg () == Reg) {
299297 if (!SnipReg)
300298 SnipReg = SrcOp.getReg ();
@@ -360,7 +358,7 @@ bool InlineSpiller::isSnippet(const LiveInterval &SnipLI) {
360358 MachineInstr &MI = *RI++;
361359
362360 // Allow copies to/from Reg.
363- if (isCopyOfBundle (MI, Reg, TII ))
361+ if (isCopyOfBundle (MI, Reg))
364362 continue ;
365363
366364 // Allow stack slot loads.
@@ -398,7 +396,7 @@ void InlineSpiller::collectRegsToSpill() {
398396 return ;
399397
400398 for (MachineInstr &MI : llvm::make_early_inc_range (MRI.reg_bundles (Reg))) {
401- Register SnipReg = isCopyOfBundle (MI, Reg, TII );
399+ Register SnipReg = isCopyOfBundle (MI, Reg);
402400 if (!isSibling (SnipReg))
403401 continue ;
404402 LiveInterval &SnipLI = LIS.getInterval (SnipReg);
@@ -521,14 +519,14 @@ void InlineSpiller::eliminateRedundantSpills(LiveInterval &SLI, VNInfo *VNI) {
521519 // Find all spills and copies of VNI.
522520 for (MachineInstr &MI :
523521 llvm::make_early_inc_range (MRI.use_nodbg_bundles (Reg))) {
524- if (!MI.mayStore () && !TII. isCopyInstr (MI ))
522+ if (!MI.isCopy () && !MI. mayStore ( ))
525523 continue ;
526524 SlotIndex Idx = LIS.getInstructionIndex (MI);
527525 if (LI->getVNInfoAt (Idx) != VNI)
528526 continue ;
529527
530528 // Follow sibling copies down the dominator tree.
531- if (Register DstReg = isCopyOfBundle (MI, Reg, TII )) {
529+ if (Register DstReg = isCopyOfBundle (MI, Reg)) {
532530 if (isSibling (DstReg)) {
533531 LiveInterval &DstLI = LIS.getInterval (DstReg);
534532 VNInfo *DstVNI = DstLI.getVNInfoAt (Idx.getRegSlot ());
@@ -872,7 +870,7 @@ foldMemoryOperand(ArrayRef<std::pair<MachineInstr *, unsigned>> Ops,
872870 if (Ops.back ().first != MI || MI->isBundled ())
873871 return false ;
874872
875- bool WasCopy = TII. isCopyInstr (*MI). has_value ();
873+ bool WasCopy = MI-> isCopy ();
876874 Register ImpReg;
877875
878876 // TII::foldMemoryOperand will do what we need here for statepoint
@@ -1157,7 +1155,7 @@ void InlineSpiller::spillAroundUses(Register Reg) {
11571155 Idx = VNI->def ;
11581156
11591157 // Check for a sibling copy.
1160- Register SibReg = isCopyOfBundle (MI, Reg, TII );
1158+ Register SibReg = isCopyOfBundle (MI, Reg);
11611159 if (SibReg && isSibling (SibReg)) {
11621160 // This may actually be a copy between snippets.
11631161 if (isRegToSpill (SibReg)) {
0 commit comments