[llvm-bugs] [Bug 28013] New: Incorrect optimization of memmove in DSE

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 5 21:11:05 PDT 2016


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

            Bug ID: 28013
           Summary: Incorrect optimization of memmove in DSE
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: eli.friedman at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Testcase:

#include <string.h>
#include <stdlib.h>
void f(char *a, char *b) {
  memmove(a, b, 10);
  memmove(a, b, 10);
}
void (*ff)(char*,char*) = f;
int main() {
  char x[20] = {1, 1};
  ff(x, x+1);
  if (x[0]) abort();
  return 0;
}

Runs correctly with clang -O0, aborts with clang -O2.

The isPossibleSelfRead helper in DSE is wrong.

(Artificial testcase.)

-- 
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/20160606/def0a423/attachment.html>


More information about the llvm-bugs mailing list