[llvm] [X86][NFC] Reorder the registers to reduce unnecessary iterations (PR #70222)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 20:09:09 PDT 2023


================
@@ -406,11 +406,11 @@ bool LiveVariables::HandlePhysRegKill(Register Reg, MachineInstr *MI) {
   return true;
 }
 
-void LiveVariables::HandleRegMask(const MachineOperand &MO) {
+void LiveVariables::HandleRegMask(const MachineOperand &MO, unsigned NumRegs) {
   // Call HandlePhysRegKill() for all live registers clobbered by Mask.
   // Clobbered registers are always dead, sp there is no need to use
   // HandlePhysRegDef().
-  for (unsigned Reg = 1, NumRegs = TRI->getNumRegs(); Reg != NumRegs; ++Reg) {
+  for (unsigned Reg = 1; Reg != NumRegs; ++Reg) {
----------------
topperc wrote:

I want to take a step back.

Have you tried checking MRI->isReserved(Reg) here? Does that do anything to improve compile time?

Where is the time spent?

Am I reading this right, that it calls HandlePhysRegKill on the super register anytime it finds one of the subregisters is clobbered? Even if its already called it before?

https://github.com/llvm/llvm-project/pull/70222


More information about the llvm-commits mailing list