[llvm-commits] [llvm] r76680 - in /llvm/trunk/lib/CodeGen: LiveInterval.cpp SimpleRegisterCoalescing.cpp
Bill Wendling
isanbard at gmail.com
Tue Jul 21 16:59:31 PDT 2009
Hi David,
> Add some support for iterative coalescers to calculate a joined live
> range's weight properly. This is turned off right now in the sense that
> you'll get an assert if you get into a situation that can only be caused
> by an iterative coalescer. All other code paths operate exactly as
> before so there is no functional change with this patch. The asserts
> should be disabled if/when an iterative coalescer gets added to trunk.
>
> - 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;
Since this is the only option available at this time, please make
this the first "if-then" statement instead of the one above it, which
asserts all of the time.
> + }
> + else {
> + // Remove this assert if you have an iterative coalescer
> + assert(0 && "Joining from spilled interval");
> + }
> + // Otherwise the weight stays the same
>
This comment is confusing. Should it be moved into the "-else" part?
> // 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;
> + }
Same comment here as above.
> + else {
> + // Remove this assert if you have an iterative coalescer
> + assert(0 && "Joining from spilled interval");
> + }
> +
> + // Otherwise the LHS weight stays the same
>
And here.
-bw
More information about the llvm-commits
mailing list