From: Matt Arsenault Date: Mon, 12 Sep 2022 19:31:03 +0000 (-0400) Subject: LiveRegUnits: Do not use phys_regs_and_masks X-Git-Tag: upstream/17.0.6~33745 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d90f7cb559e32c2cbf1f9839d7e8e0cc0be189ba;p=platform%2Fupstream%2Fllvm.git LiveRegUnits: Do not use phys_regs_and_masks Somehow DeadMachineInstructionElim is about 3x slower when using it. Hopefully this reverses the compile time regression reported for b5041527c75de2f409aa9e2e6deba12b17834c59. --- diff --git a/llvm/lib/CodeGen/LiveRegUnits.cpp b/llvm/lib/CodeGen/LiveRegUnits.cpp index d8d8bd5..b913e554 100644 --- a/llvm/lib/CodeGen/LiveRegUnits.cpp +++ b/llvm/lib/CodeGen/LiveRegUnits.cpp @@ -39,34 +39,41 @@ void LiveRegUnits::addRegsInMask(const uint32_t *RegMask) { void LiveRegUnits::stepBackward(const MachineInstr &MI) { // Remove defined registers and regmask kills from the set. - for (const MachineOperand &MOP : phys_regs_and_masks(MI)) { + for (const MachineOperand &MOP : MI.operands()) { if (MOP.isRegMask()) { removeRegsNotPreserved(MOP.getRegMask()); continue; } - if (MOP.isDef()) + if (MOP.isReg() && MOP.isDef() && MOP.getReg().isPhysical()) removeReg(MOP.getReg()); } // Add uses to the set. - for (const MachineOperand &MOP : phys_regs_and_masks(MI)) { + for (const MachineOperand &MOP : MI.operands()) { if (!MOP.isReg() || !MOP.readsReg()) continue; - addReg(MOP.getReg()); + + if (MOP.getReg() && MOP.getReg().isPhysical()) + addReg(MOP.getReg()); } } void LiveRegUnits::accumulate(const MachineInstr &MI) { // Add defs, uses and regmask clobbers to the set. - for (const MachineOperand &MOP : phys_regs_and_masks(MI)) { + for (const MachineOperand &MOP : MI.operands()) { + if (MOP.isReg()) { + if (!MOP.getReg().isPhysical()) + continue; + if (MOP.isDef() || MOP.readsReg()) + addReg(MOP.getReg()); + continue; + } + if (MOP.isRegMask()) { addRegsInMask(MOP.getRegMask()); continue; } - if (!MOP.isDef() && !MOP.readsReg()) - continue; - addReg(MOP.getReg()); } }