diff options
author | Ilya Enkovich <ilya.enkovich@intel.com> | 2015-06-03 11:31:08 +0000 |
---|---|---|
committer | Ilya Enkovich <ienkovich@gcc.gnu.org> | 2015-06-03 11:31:08 +0000 |
commit | 67321dcf21659f2d12d278ce8ef6250bd0eca714 (patch) | |
tree | 159c20a41fd9ceadaaad8b776d8940570e672050 /gcc | |
parent | b2b43e33298fd62d7348696044e51086a02b0cb2 (diff) | |
download | gcc-67321dcf21659f2d12d278ce8ef6250bd0eca714.zip gcc-67321dcf21659f2d12d278ce8ef6250bd0eca714.tar.gz gcc-67321dcf21659f2d12d278ce8ef6250bd0eca714.tar.bz2 |
ipa-chkp.c (chkp_maybe_create_clone): Create alias reference when cloning alias node.
gcc/
* ipa-chkp.c (chkp_maybe_create_clone): Create alias
reference when cloning alias node.
gcc/testsuite/
* gcc.dg/lto/chkp-removed-alias_0.c: New.
From-SVN: r224074
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ipa-chkp.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/chkp-removed-alias_0.c | 28 |
4 files changed, 42 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9f054ff1..d83cf50 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-06-03 Ilya Enkovich <ilya.enkovich@intel.com> + + * ipa-chkp.c (chkp_maybe_create_clone): Create alias + reference when cloning alias node. + 2015-06-03 Martin Liska <mliska@suse.cz> * alloc-pool.h (struct pool_usage): Correct space padding. diff --git a/gcc/ipa-chkp.c b/gcc/ipa-chkp.c index c710291..87e21ca 100644 --- a/gcc/ipa-chkp.c +++ b/gcc/ipa-chkp.c @@ -616,12 +616,7 @@ chkp_maybe_create_clone (tree fndecl) /* Clone all aliases. */ for (i = 0; node->iterate_direct_aliases (i, ref); i++) - { - struct cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring); - struct cgraph_node *chkp_alias - = chkp_maybe_create_clone (alias->decl); - chkp_alias->create_reference (clone, IPA_REF_ALIAS, NULL); - } + chkp_maybe_create_clone (ref->referring->decl); /* Clone all thunks. */ for (e = node->callers; e; e = e->next_caller) @@ -645,7 +640,10 @@ chkp_maybe_create_clone (tree fndecl) ref = node->ref_list.first_reference (); if (ref) - chkp_maybe_create_clone (ref->referred->decl); + { + target = chkp_maybe_create_clone (ref->referred->decl); + clone->create_reference (target, IPA_REF_ALIAS); + } if (node->alias_target) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 12bf61c..5567282 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2015-06-03 Ilya Enkovich <ilya.enkovich@intel.com> + * gcc.dg/lto/chkp-removed-alias_0.c: New. + +2015-06-03 Ilya Enkovich <ilya.enkovich@intel.com> + * gcc.dg/lto/chkp-privatize-1_0.c: New. * gcc.dg/lto/chkp-privatize-1_1.c: New. * gcc.dg/lto/chkp-privatize-2_0.c: New. diff --git a/gcc/testsuite/gcc.dg/lto/chkp-removed-alias_0.c b/gcc/testsuite/gcc.dg/lto/chkp-removed-alias_0.c new file mode 100644 index 0000000..96d728d --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/chkp-removed-alias_0.c @@ -0,0 +1,28 @@ +/* { dg-lto-do link } */ +/* { dg-require-effective-target mpx } */ +/* { dg-lto-options { { -O2 -flto -flto-partition=max -fcheck-pointer-bounds -mmpx } } } */ + +int test1 (const char *c) +{ + return c[0] * 2; +} + +int test2 (const char *c) +{ + return c[1] * 3; +} + +int test1_alias (const char *c) __attribute__ ((alias ("test1"))); +int test2_alias (const char *c) __attribute__ ((alias ("test2"))); + +struct S +{ + int (*fnptr[2]) (const char *); +} S; + +struct S s = {test1_alias, test2_alias}; + +int main (int argc, const char **argv) +{ + return s.fnptr[argc] (argv[0]); +} |