-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Open
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillallvm:GVNGVN and NewGVN stages (Global value numbering)GVN and NewGVN stages (Global value numbering)
Description
| Bugzilla Link | 25559 |
| Version | trunk |
| OS | Windows NT |
| Reporter | LLVM Bugzilla Contributor |
| CC | @hfinkel |
Extended Description
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;
}
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillallvm:GVNGVN and NewGVN stages (Global value numbering)GVN and NewGVN stages (Global value numbering)