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

Evan Cheng evan.cheng at apple.com
Thu Feb 7 11:47:02 PST 2008


My fault. Patch applied. Thanks.

Evan

On Feb 7, 2008, at 12:04 AM, Holger Schurig wrote:

> 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);
>   }
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list