[llvm-bugs] [Bug 39207] New: Loop hoisting

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 7 02:12:15 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=39207

            Bug ID: 39207
           Summary: Loop hoisting
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

Not sure how often this happens in the real world apps but anyway idea is..

int foo(void)
{
    double  *array = calloc(ARRAY_SIZE, sizeof(double));
    double  sum = 0;
    int     i;
    for (i = 0; i < N_TIMES; i++) {
        // lot of code
        // well, this loop does not even depend on "i", hoist it?
        for (int j = 0; j < ARRAY_SIZE; j += 8) {
            sum += array[j] + array[j+1] + array[j+2] + array[j+3] + array[j+4]
+ array[j+5] +  array[j+6] + array[j+7];
        }
    }

    return sum;
}

Let's say we have the big outer loop with many inner loops. Can LLVM check if
these loops really depend on the outer loop and if not, hoist them?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181007/b93fef42/attachment-0001.html>


More information about the llvm-bugs mailing list