[LLVMbugs] [Bug 10920] 401.bzip2 fails with -arch i386 -enable-iv-rewrite=false

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Sep 14 18:21:49 PDT 2011


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

Andrew Trick <atrick at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
          Component|Loop Optimizer              |Register Allocator
         Resolution|                            |FIXED
         AssignedTo|atrick at apple.com            |unassignedbugs at nondot.org

--- Comment #4 from Andrew Trick <atrick at apple.com> 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.



More information about the llvm-bugs mailing list