[LLVMbugs] [Bug 1865] New: GEPs aren't amenable to further analysis

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Dec 16 22:55:45 PST 2007


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

           Summary: GEPs aren't amenable to further analysis
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Loop Optimizer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nicholas at mxc.ca
                CC: llvmbugs at cs.uiuc.edu


This example is taken from the SLP paper as an example of something that isn't
vectorizable:

  void f(int *dst, int *end, int *src1, int *src2) {
    do {
      dst[0] = (src1[0] + src2[0]) >> 1;
      dst[1] = (src1[1] + src2[1]) >> 1;
      dst[2] = (src1[2] + src2[2]) >> 1;
      dst[3] = (src1[3] + src2[3]) >> 1;

      dst += 4;
      src1 += 4;
      src2 += 4;
    } while (dst != end);

    return;
  }

The problem is that dst[1] is calculated using a variable GEP. Looking just at
the instructions relevant to the computation of dst[1], we see:

        %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb ]          ; <i32> 
[#uses=2]
        %src1_addr.0.rec = shl i32 %indvar, 2           ; <i32> [#uses=7]
        %src1_addr.0.sum5657 = or i32 %src1_addr.0.rec, 1               ; <i32>
[#uses=3]
        %tmp19 = getelementptr i32* %dst, i32 %src1_addr.0.sum5657             
; <i32*> [#uses=1]

It would be much nicer if we could say that %tmp19 = GEP %dst, 1. With this
change, I think the code from the example would be vectorizable.


-- 
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