[LLVMdev] [PATCH] fix warning: 'NumFolded' defined but not used

Holger Schurig hs4233 at mail.mn-solutions.de
Thu Feb 7 00:04:18 PST 2008


lib/CodeGen/RegAllocLocal.cpp:38: warning: 'NumFolded' defined but not used

This has been introduced because of r46821.

However, maybe removing just the variable isn't enought,
because the comments in the section that got modified
by 46821 are not optimal:

  if (PhysReg) {   // Register is available, allocate it!
    assignVirtToPhysReg(VirtReg, PhysReg);
  } else {         // No registers available.
    // If we can fold this spill into this instruction, do so now.

This comment says that something should be folded.

    SmallVector<unsigned, 2> Ops;
    Ops.push_back(OpNum);

I don't understand the usage of Ops. Seems not to be
used at all.

    // It looks like we can't fold this virtual register load into this
    // instruction.  Force some poor hapless value out of the register file to
    // make room for the new register, and reload it.

And this comment says that it can't have been folded,
so the first comment seems to be superfluous.

    PhysReg = getReg(MBB, MI, VirtReg);
  }



--- svn.llvm.orig/lib/CodeGen/RegAllocLocal.cpp
+++ svn.llvm/lib/CodeGen/RegAllocLocal.cpp
@@ -35,7 +35,6 @@

 STATISTIC(NumStores, "Number of stores added");
 STATISTIC(NumLoads , "Number of loads added");
-STATISTIC(NumFolded, "Number of loads/stores folded into instructions");

 namespace {
   static RegisterRegAlloc
@@ -500,12 +499,7 @@
   if (PhysReg) {   // Register is available, allocate it!
     assignVirtToPhysReg(VirtReg, PhysReg);
   } else {         // No registers available.
-    // If we can fold this spill into this instruction, do so now.
-    SmallVector<unsigned, 2> Ops;
-    Ops.push_back(OpNum);
-
-    // It looks like we can't fold this virtual register load into this
-    // instruction.  Force some poor hapless value out of the register file to
+    // Force some poor hapless value out of the register file to
     // make room for the new register, and reload it.
     PhysReg = getReg(MBB, MI, VirtReg);
   }



More information about the llvm-dev mailing list