[llvm] [X86][RA] Add two address hints for compressible NDD instructions. (PR #98603)
Freddy Ye via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 5 00:41:10 PDT 2024
================
@@ -1082,8 +1088,44 @@ bool X86RegisterInfo::getRegAllocationHints(Register VirtReg,
VirtReg, Order, Hints, MF, VRM, Matrix);
unsigned ID = RC.getID();
- if (ID != X86::TILERegClassID)
+
+ if (ID != X86::TILERegClassID) {
+ if (!VRM || DisableRegAllocNDDHints)
+ return BaseImplRetVal;
+
+ // Add any two address hints after any copy hints.
+ SmallSet<unsigned, 4> TwoAddrHints;
+
+ auto tryAddNDDHint = [&](const MachineOperand &MO) -> void {
+ Register Reg = MO.getReg();
+ Register PhysReg =
+ Register::isPhysicalRegister(Reg) ? Reg : Register(VRM->getPhys(Reg));
+ if (PhysReg && !MRI->isReserved(PhysReg) && !is_contained(Hints, PhysReg))
+ TwoAddrHints.insert(PhysReg);
+ };
+
+ for (auto &MO : MRI->reg_nodbg_operands(VirtReg)) {
+ const MachineInstr &MI = *MO.getParent();
+ if (X86::getNonNDVariant(MI.getOpcode())) {
----------------
FreddyLeaf wrote:
[2eac5de](https://github.com/llvm/llvm-project/pull/98603/commits/2eac5defb8c760c595c1ccb3a9981e1905a319af)
https://github.com/llvm/llvm-project/pull/98603
More information about the llvm-commits
mailing list