[llvm-bugs] [Bug 25559] New: [GVN] Should be able to PRE a load from memset
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Nov 17 12:53:37 PST 2015
https://llvm.org/bugs/show_bug.cgi?id=25559
Bug ID: 25559
Summary: [GVN] Should be able to PRE a load from memset
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: mcrosier at codeaurora.org
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Currently, GVN can pre loads from calloc like functions. For example, in the
below test case the store to 'res' will be converted from a load into a
constant zero.
#include <strings.h>
#include <stdlib.h>
int *test_calloc(int n, int *res)
{
if (n == 0)
return 0;
int *ptr = (int *)calloc(n, sizeof(int));
*res = ptr[n-1];
return ptr;
}
However, PRE falls apart with this example:
int *test_malloc_memset_zero(int n, int *res)
{
if (n == 0)
return 0;
int *ptr = (int *)malloc(n * sizeof(int));
bzero(ptr, n * sizeof(int));
*res = ptr[n-1];
return ptr;
}
--
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/20151117/f00369e7/attachment.html>
More information about the llvm-bugs
mailing list