[llvm-commits] [llvm] r76680 - in /llvm/trunk/lib/CodeGen: LiveInterval.cpp SimpleRegisterCoalescing.cpp

Evan Cheng evan.cheng at apple.com
Tue Jul 21 22:49:56 PDT 2009


Since both snippets are identical, please factor it out to function in  
LiveInterval.h. Thanks.

Evan

On Jul 21, 2009, at 4:36 PM, David Greene wrote:

>
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
> +++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Tue Jul 21 18:36:14 2009
> @@ -503,7 +503,23 @@
>     InsertPos = addRangeFrom(*I, InsertPos);
>   }
>
> -  weight += Other.weight;
> +  // If either of these intervals was spilled, the weight is the
> +  // weight of the non-spilled interval.  This can only happen with
> +  // iterative coalescers.
> +
> +  if (weight == HUGE_VALF && !TargetRegisterInfo::isPhysicalRegister 
> (reg)) {
> +    // Remove this assert if you have an iterative coalescer
> +    assert(0 && "Joining to spilled interval");
> +    weight = Other.weight;
> +  }
> +  else if (Other.weight != HUGE_VALF) {
> +    weight += Other.weight;
> +  }
> +  else {
> +    // Remove this assert if you have an iterative coalescer
> +    assert(0 && "Joining from spilled interval");
> +  }
> +  // Otherwise the weight stays the same
>
>   // Update regalloc hint if currently there isn't one.
>   if (TargetRegisterInfo::isVirtualRegister(reg) &&
>
> Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=76680&r1=76679&r2=76680&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Tue Jul 21  
> 18:36:14 2009
> @@ -1969,7 +1969,24 @@
>     LHSValNo->setHasPHIKill(true);
>   LHS.addKills(LHSValNo, VNI->kills);
>   LHS.MergeRangesInAsValue(RHS, LHSValNo);
> -  LHS.weight += RHS.weight;
> +
> +  // If either of these intervals was spilled, the weight is the
> +  // weight of the non-spilled interval.  This can only happen
> +  // with iterative coalescers.
> +  if (LHS.weight == HUGE_VALF && ! 
> TargetRegisterInfo::isPhysicalRegister(LHS.reg)) {
> +    // Remove this assert if you have an iterative coalescer
> +    assert(0 && "Joining to spilled interval");
> +    LHS.weight = RHS.weight;
> +  }
> +  else if (RHS.weight != HUGE_VALF) {
> +    LHS.weight += RHS.weight;
> +  }
> +  else {
> +    // Remove this assert if you have an iterative coalescer
> +    assert(0 && "Joining from spilled interval");
> +  }
> +
> +  // Otherwise the LHS weight stays the same
>
>   // Update regalloc hint if both are virtual registers.
>   if (TargetRegisterInfo::isVirtualRegister(LHS.reg) &&
>
>
> _______________________________________________
> 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