[llvm-bugs] [Bug 27857] New: licm miscompile with noalias and call which exits program

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 24 11:05:57 PDT 2016


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

            Bug ID: 27857
           Summary: licm miscompile with noalias and call which exits
                    program
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: eli.friedman at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Testcase:

#include <stdlib.h>
void f() { exit(0); }
void (*ff)() = f;
void g(int* restrict a) {
    for (int i = 0; i < 1000; ++i) {
        ff();
        *a += 1;
    }
}
void (*gg)(int* restrict) = g;
int main() {
    gg(0);
}

Works with gcc and clang -O0; crashes with clang -O2.

I think LICM is relying too much on "MayThrow" to conclude that function calls
will return normally.

Testcase is artificial.

-- 
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/20160524/e3277d4e/attachment-0001.html>


More information about the llvm-bugs mailing list