+ }
+ }
+ // Treat undef use like defs for copy propagation but not for
+ // dead copy. We would need to do a liveness check to be sure the copy
+ // is dead for undef uses.
+ // The backends are allowed to do whatever they want with undef value
+ // and we cannot be sure this register will not be rewritten to break
+ // some false dependencies for the hardware for instance.
+ if (MO.isUndef())
+ Defs.push_back(Reg);
+ }
+
+ // The instruction has a register mask operand which means that it clobbers
+ // a large set of registers. It is possible to use the register mask to
+ // prune the available copies, but treat it like a basic block boundary for
+ // now.
+ if (RegMaskOpNum >= 0) {
+ // Erase any MaybeDeadCopies whose destination register is clobbered.
+ const MachineOperand &MaskMO = MI->getOperand(RegMaskOpNum);
+ for (SmallSetVector<MachineInstr*, 8>::iterator
+ DI = MaybeDeadCopies.begin(), DE = MaybeDeadCopies.end();
+ DI != DE; ++DI) {
+ unsigned Reg = (*DI)->getOperand(0).getReg();
+ if (MRI->isReserved(Reg) || !MaskMO.clobbersPhysReg(Reg))
+ continue;
+ DEBUG(dbgs() << "MCP: Removing copy due to regmask clobbering: ";
+ (*DI)->dump());
+ (*DI)->eraseFromParent();
+ Changed = true;
+ ++NumDeletes;