[llvm-bugs] [Bug 43924] New: Loop peeling from the end of the loop

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 6 12:45:33 PST 2019


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

            Bug ID: 43924
           Summary: Loop peeling from the end of the loop
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: lebedev.ri at gmail.com
                CC: llvm-bugs at lists.llvm.org

As noted in https://bugs.llvm.org/show_bug.cgi?id=43892
we currently only peel from the front of the loop.
But we could also peel from the end: 
https://godbolt.org/z/bcVXc_

void sink();
void cleanup();
void bad(int num) {
    for(int i = 0; i < num; ++i) {
        if(i+1 == num)
            cleanup();
        sink();
    }
}
void good(int num) {
    if(num <= 0)
        return;
    for(int i = 0; i < num; ++i) 
        sink();
    cleanup();
}

-- 
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/20191106/cfa869aa/attachment.html>


More information about the llvm-bugs mailing list