[llvm-commits] [llvm] r62144 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/X86/2009-01-12-CoalescerBug.ll

Nick Lewycky nicholas at mxc.ca
Mon Jan 12 20:01:52 PST 2009


Evan Cheng wrote:
> Author: evancheng
> Date: Mon Jan 12 21:57:45 2009
> New Revision: 62144
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=62144&view=rev
> Log:
> FIX llvm-gcc bootstrap on x86_64 linux. If a virtual register is copied to a physical register, it's not necessarily defined by a copy. We have to watch out it doesn't clobber any sub-register that might be live during its live interval. If the live interval crosses a basic block, then it's not safe to check with the less conservative check (by scanning uses and defs) because it's possible a sub-register might be live out of the block.
> 
> Added:
>     llvm/trunk/test/CodeGen/X86/2009-01-12-CoalescerBug.ll
> Modified:
>     llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
> 
> Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=62144&r1=62143&r2=62144&view=diff
> 
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Jan 12 21:57:45 2009
> @@ -1731,7 +1731,20 @@
>      // If it's coalescing a virtual register to a physical register, estimate
>      // its live interval length. This is the *cost* of scanning an entire live
>      // interval. If the cost is low, we'll do an exhaustive check instead.
> +
> +    // If this is something like this:
> +    // BB1:
> +    // v1024 = op
> +    // ...
> +    // BB2:
> +    // ...
> +    // RAX   = v1024
> +    //
> +    // That is, the live interval of v1024 crosses a bb. Then we can't rely on
> +    // less conservative check. It's possible a sub-register is defined before
> +    // v1024 (or live in) and live out of BB1.
>      if (RHS.containsOneValue() &&
> +	li_->intervalIsInOneMBB(RHS) &&

Tab!

>          li_->getApproximateInstructionCount(RHS) <= 10) {
>        // Perform a more exhaustive check for some common cases.
>        if (li_->conflictsWithPhysRegRef(RHS, LHS.reg, true, JoinedCopies))




More information about the llvm-commits mailing list