[Bug ipa/86695] New: Calls to builtins do not use visibility information
amonakov at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jul 27 08:46:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86695
Bug ID: 86695
Summary: Calls to builtins do not use visibility information
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Keywords: missed-optimization, visibility
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: amonakov at gcc dot gnu.org
CC: marxin at gcc dot gnu.org
Target Milestone: ---
On the following testcase all 4 generated calls to memcpy/malloc should use
direct calls thanks to provided visibility attribute, but only the one in 'g2'
does. The other calls are assumed to be external and go via the PLT with the
corresponding size/speed penalty with -fpic -m32.
// gcc -O2 -fpic -m32
#pragma GCC visibility push(hidden)
void *memcpy(void *, const void *, __SIZE_TYPE__);
void *malloc(__SIZE_TYPE__);
#pragma GCC visibility pop
struct s {
char c[1024*1024];
};
void f1(struct s a[2])
{
a[1] = a[0];
}
void f2(struct s a[2])
{
memcpy(a+1, a, sizeof *a);
}
void *g1()
{
return __builtin_malloc(42);
}
void *g2()
{
return malloc(42);
}
More information about the Gcc-bugs
mailing list