[LLVMbugs] [Bug 5319] New: store not sunk by licm

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Oct 27 09:25:09 PDT 2009


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

           Summary: store not sunk by licm
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Loop Optimizer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=3708)
 --> (http://llvm.org/bugs/attachment.cgi?id=3708)
testcase .ll

This simple C program:

  void g(int *);

  void f() {
    int array[20];
    int i;
    for (i = 0; i<100; i++) {
      array [0] = 0;
    }
    g(array);
  }

is optimized down to:

  [...]
  bb:
    %i.04 = phi i32 [ 0, %entry ], [ %1, %bb ]
    store i32 0, i32* %0, align 4
    %1 = add nsw i32 %i.04, 1
    %exitcond = icmp eq i32 %1, 100
    br i1 %exitcond, label %bb2, label %bb
  [...]

by llvm-gcc -O2. If we were to run another opt -licm over this then it sinks
the store instruction. The problem is that we have more complicated IR at the
point of time when LICM actually runs:

  [...]
  bb:
    %3 = phi i32* [ %1, %bb.nph ], [ %2, %bb1 ]
    %storemerge1 = phi i32 [ 0, %bb.nph ], [ %storemerge, %bb1 ]
    store i32 0, i32* %3, align 4
    %4 = add nsw i32 %storemerge1, 1
    br label %bb1
  bb1:
    %storemerge = phi i32 [ %4, %bb ]
    %5 = icmp slt i32 %storemerge, 100
    br i1 %5, label %bb, label %bb1.bb2_crit_edge
  [...]

The full .ll that LICM isn't getting is attached.


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