Lines Matching defs:Copy
1 //===- MachineCopyPropagation.cpp - Machine Copy Propagation Pass ---------===//
244 auto &Copy = I.first->second;
245 if (!is_contained(Copy.DefRegs, Def))
246 Copy.DefRegs.push_back(Def);
247 Copy.LastSeenUseInCopy = MI;
419 bool eraseIfRedundant(MachineInstr &Copy, MCRegister Src, MCRegister Def);
422 bool isForwardableRegClassCopy(const MachineInstr &Copy,
424 bool isBackwardPropagatableRegClassCopy(const MachineInstr &Copy,
449 "Machine Copy Propagation Pass", false, false)
457 if (MachineInstr *Copy = Tracker.findCopyForUnit(Unit, *TRI)) {
459 LLVM_DEBUG(dbgs() << "MCP: Copy is used - not dead: "; Copy->dump());
460 MaybeDeadCopies.remove(Copy);
462 CopyDbgUsers[Copy].insert(&Reader);
477 if (MachineInstr *Copy = Tracker.findCopyForUnit(Unit, *TRI))
478 MaybeDeadCopies.remove(Copy);
506 /// Remove instruction \p Copy if there exists a previous copy that copies the
509 bool MachineCopyPropagation::eraseIfRedundant(MachineInstr &Copy,
518 Tracker.findAvailCopy(Copy, Def, *TRI, *TII, UseCopyInstr);
529 LLVM_DEBUG(dbgs() << "MCP: copy is a NOP, removing: "; Copy.dump());
531 // Copy was redundantly redefining either Src or Def. Remove earlier kill
532 // flags between Copy and PrevCopy because the value will be reused now.
534 isCopyInstr(Copy, *TII, UseCopyInstr);
540 make_range(PrevCopy->getIterator(), Copy.getIterator()))
549 Copy.eraseFromParent();
556 const MachineInstr &Copy, const MachineInstr &UseI, unsigned UseIdx) {
558 isCopyInstr(Copy, *TII, UseCopyInstr);
570 /// Decide whether we should forward the source of \param Copy to its use in
573 bool MachineCopyPropagation::isForwardableRegClassCopy(const MachineInstr &Copy,
577 isCopyInstr(Copy, *TII, UseCopyInstr);
594 /// RegClassA = COPY RegClassB // Copy parameter
700 MachineInstr *Copy = Tracker.findAvailCopy(MI, MOUse.getReg().asMCReg(),
702 if (!Copy)
706 isCopyInstr(*Copy, *TII, UseCopyInstr);
712 // MI might use a sub-register of the Copy destination, in which case the
713 // forwarded register is the matching sub-register of the Copy source.
717 "MI source is not a sub-register of Copy destination");
720 LLVM_DEBUG(dbgs() << "MCP: Copy source does not have sub-register "
730 if (!isForwardableRegClassCopy(*Copy, MI, OpIdx))
742 LLVM_DEBUG(dbgs() << "MCP: Copy source overlap with dest in " << MI);
754 << "\n in " << MI << " from " << *Copy);
766 make_range(Copy->getIterator(), std::next(MI.getIterator())))
830 LLVM_DEBUG(dbgs() << "MCP: Copy is a deletion candidate: "; MI.dump());
832 // Copy is now a candidate for deletion.
1011 MachineInstr *Copy = Tracker.findAvailBackwardCopy(
1013 if (!Copy)
1017 isCopyInstr(*Copy, *TII, UseCopyInstr);
1024 if (!isBackwardPropagatableRegClassCopy(*Copy, MI, OpIdx))
1035 << MI << " from " << *Copy);
1041 MaybeDeadCopies.insert(Copy);
1101 if (auto *Copy = Tracker.findCopyDefViaUnit(Unit, *TRI)) {
1102 CopyDbgUsers[Copy].insert(&MI);
1113 for (auto *Copy : MaybeDeadCopies) {
1115 isCopyInstr(*Copy, *TII, UseCopyInstr);
1118 SmallVector<MachineInstr *> MaybeDeadDbgUsers(CopyDbgUsers[Copy].begin(),
1119 CopyDbgUsers[Copy].end());
1122 Copy->eraseFromParent();
1321 LLVM_DEBUG(dbgs() << "MCP: Copy source of\n");