[llvm-commits] [llvm] r108120 - /llvm/trunk/lib/Target/X86/X86FloatingPointRegKill.cpp

Chris Lattner clattner at apple.com
Sun Jul 11 19:53:40 PDT 2010


On Jul 11, 2010, at 7:12 PM, Jakob Stoklund Olesen wrote:

> Author: stoklund
> Date: Sun Jul 11 21:12:47 2010
> New Revision: 108120
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=108120&view=rev
> Log:
> A basic block that only uses RFP registers still needs the FP_REG_KILL marker.
> 
> This fixes PR7375.

Thanks for working on this!  I don't get it though: shouldn't a FP_REG_KILL in any block that defines an instruction be sufficient?  Previously that was enough to ensure that any cross-block fp stack values would get spilled.  Is this an issue due to live range splitting?

-Chris

> 
> Modified:
>    llvm/trunk/lib/Target/X86/X86FloatingPointRegKill.cpp
> 
> Modified: llvm/trunk/lib/Target/X86/X86FloatingPointRegKill.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPointRegKill.cpp?rev=108120&r1=108119&r2=108120&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86FloatingPointRegKill.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86FloatingPointRegKill.cpp Sun Jul 11 21:12:47 2010
> @@ -72,18 +72,15 @@
> /// stack code, and thus needs an FP_REG_KILL.
> static bool ContainsFPStackCode(MachineBasicBlock *MBB,
>                                 const MachineRegisterInfo &MRI) {
> -  // Scan the block, looking for instructions that define fp stack vregs.
> +  // Scan the block, looking for instructions that define or use fp stack vregs.
>   for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end();
>        I != E; ++I) {
> -    if (I->getNumOperands() == 0 || !I->getOperand(0).isReg())
> -      continue;
> -    
>     for (unsigned op = 0, e = I->getNumOperands(); op != e; ++op) {
> -      if (!I->getOperand(op).isReg() || !I->getOperand(op).isDef())
> +      if (!I->getOperand(op).isReg())
>         continue;
> -      
> -      if (isFPStackVReg(I->getOperand(op).getReg(), MRI))
> -        return true;
> +      if (unsigned Reg = I->getOperand(op).getReg())
> +        if (isFPStackVReg(Reg, MRI))
> +          return true;
>     }
>   }
> 
> @@ -108,8 +105,8 @@
> 
> bool FPRegKiller::runOnMachineFunction(MachineFunction &MF) {
>   // If we are emitting FP stack code, scan the basic block to determine if this
> -  // block defines any FP values.  If so, put an FP_REG_KILL instruction before
> -  // the terminator of the block.
> +  // block defines or uses any FP values.  If so, put an FP_REG_KILL instruction
> +  // before the terminator of the block.
> 
>   // Note that FP stack instructions are used in all modes for long double,
>   // so we always need to do this check.
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list