From: Richard Guenther Date: Tue, 1 Mar 2011 09:46:19 +0000 (+0000) Subject: re PR lto/47924 (Missed optimization with LTO) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7a00d9eaf66d34d3e26938e890a4fb880df531f4;p=gcc.git re PR lto/47924 (Missed optimization with LTO) 2011-03-01 Richard Guenther PR lto/47924 * lto-streamer.c (lto_record_common_node): Also register the canonical type. * gcc.dg/lto/pr47924_0.c: New testcase. From-SVN: r170589 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5d567fb498a..79487c18b0c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-03-01 Richard Guenther + + PR lto/47924 + * lto-streamer.c (lto_record_common_node): Also register + the canonical type. + 2011-03-01 Richard Guenther PR lto/46911 diff --git a/gcc/lto-streamer.c b/gcc/lto-streamer.c index dba9d2d5dd7..67132ef1dff 100644 --- a/gcc/lto-streamer.c +++ b/gcc/lto-streamer.c @@ -527,7 +527,9 @@ lto_record_common_node (tree *nodep, VEC(tree, heap) **common_nodes, are set by the middle-end. */ if (in_lto_p) TYPE_CANONICAL (node) = NULL_TREE; - *nodep = node = gimple_register_type (node); + node = gimple_register_type (node); + TYPE_CANONICAL (node) = gimple_register_canonical_type (node); + *nodep = node; } /* Return if node is already seen. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 65e0db406bf..d5e79f82f2e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-03-01 Richard Guenther + + PR lto/47924 + * gcc.dg/lto/pr47924_0.c: New testcase. + 2011-03-01 Richard Guenther PR lto/46911 diff --git a/gcc/testsuite/gcc.dg/lto/pr47924_0.c b/gcc/testsuite/gcc.dg/lto/pr47924_0.c new file mode 100644 index 00000000000..f7fdb44b073 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr47924_0.c @@ -0,0 +1,19 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-O2 -flto}} } */ + +extern void link_error (void); +short *p __attribute__((used)); +int i __attribute__((used)); + +int main() +{ + if (i == 0) + return; + + *p = 0; + + if (i == 0) + link_error (); + + return 0; +}