[llvm-bugs] [Bug 37313] New: Missed optimizations for comparison of doubles in loops

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 2 08:26:44 PDT 2018


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

            Bug ID: 37313
           Summary: Missed optimizations for comparison of doubles in
                    loops
           Product: libraries
           Version: 6.0
          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

Hello,

double test(double *arr, int size) {
    double m = INFINITY;
    int flag = 1;
    int i;
    double a;

    for (i=0; i<size;++i) {
        a = arr[i];
        if (a <= m ) {
            m = a;
            flag = 0;
        }
        ++i;
    }
    if (flag) {
        return 0.0;
    }
    return m;
}



ASM outputs:
https://godbolt.org/g/iSjSGW

Seems like Clang generates worse code because LLVM missed same patterns..

-- 
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/20180502/696d8b52/attachment.html>


More information about the llvm-bugs mailing list