[llvm] d90f7cb - LiveRegUnits: Do not use phys_regs_and_masks
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 12 14:21:32 PDT 2022
Author: Matt Arsenault
Date: 2022-09-12T17:21:24-04:00
New Revision: d90f7cb559e32c2cbf1f9839d7e8e0cc0be189ba
URL: https://github.com/llvm/llvm-project/commit/d90f7cb559e32c2cbf1f9839d7e8e0cc0be189ba
DIFF: https://github.com/llvm/llvm-project/commit/d90f7cb559e32c2cbf1f9839d7e8e0cc0be189ba.diff
LOG: 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.
Added:
Modified:
llvm/lib/CodeGen/LiveRegUnits.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/LiveRegUnits.cpp b/llvm/lib/CodeGen/LiveRegUnits.cpp
index d8d8bd5d61a2..b913e5543729 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());
}
}
More information about the llvm-commits
mailing list