[LLVMbugs] [Bug 1501] NEW: Critical loop backedges are split and copies placed on the edge

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Jun 6 11:10:52 PDT 2007


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

           Summary: Critical loop backedges are split and copies placed on
                    the edge
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sabre at nondot.org


It looks like backedges in loops sometimes get split and phi copies end up in them or something.  This 
is badness:

extern double _Complex conj (double _Complex __z) __attribute__ ((__nothrow__));

#define DELAY 2000000
#define SIZE 1024

void
zgemm (int k, _Complex *a, _Complex *b, _Complex *c)
{
  int i, l;
  _Complex double temp = (0.0,0.0);

  for (i=0; i < DELAY; i++)
    for (l=0; l < k; l++)
      temp = temp + conj (a[l]) * b[l];
  c[0] = temp;
}

_Complex c;

int test (void) {
  _Complex a[SIZE];
  _Complex b[SIZE];
  zgemm (SIZE, a, b, &c);
  return 0;
}

This currently compiles the inner loop into:

LBB2_2: #bb11.us
        movsd (%esp,%ecx), %xmm2
        movsd 16384(%esp,%ecx), %xmm3
        movapd %xmm3, %xmm4
        mulsd %xmm2, %xmm4
        movsd 16392(%esp,%ecx), %xmm5
        mulsd %xmm5, %xmm2
        movsd 8(%esp,%ecx), %xmm6
        mulsd %xmm6, %xmm3
        subsd %xmm2, %xmm3
        addsd %xmm0, %xmm3
        mulsd %xmm5, %xmm6
        addsd %xmm6, %xmm4
        addsd %xmm1, %xmm4
        incl %edx
        addl $16, %ecx
        cmpl $1023, %edx
        jle LBB2_6      #bb11.us.bb11.us_crit_edge
...
LBB2_6: #bb11.us.bb11.us_crit_edge
        movapd %xmm3, %xmm0
        movapd %xmm4, %xmm1
        jmp LBB2_2      #bb11.us

Ick.

-Chris



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list