http://llvm.org/bugs/show_bug.cgi?id=10920

Andrew Trick <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
          Component|Loop Optimizer              |Register Allocator
         Resolution|                            |FIXED
         AssignedTo|[email protected]            |[email protected]

--- Comment #4 from Andrew Trick <[email protected]> 2011-09-14 20:21:48 CDT ---
We have a loop that looks like this:
         a = 0;
         while (a < t && g < s-1) {
            g++;
            a += array[g];
         }

         if (g > x
             && expr1 && expr2 && expr3) {
            a -= array[g];
            g--;
         }
         call(a)

Early CSE removes the second load from array[g] and subsequent subtract. Now
the value of 'a' when all conditions evaluate true is actually it's old loop
pre increment value. Hence we need a copy on this path, or on all other paths
to call(a).

With no IV rewrite, a's pre increment value is itself a copy of 'a' from the
previous loop iteration. So now we have multiple copies of 'a'. But the pre
increment copy is NOT the same value as the critical edge copies.
RegistersDefinedFromSameValue does perform a reaching value check, but was
performing it incorrectly and removing one of the copies.

In the full test case, phi elimination splits several critical edges at expr1
&& expr2... and inserts copies from a. That's not so good, but will be fixed
eventually and not the subject of this bug.

Fixed in r139765

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to