re PR lto/47924 (Missed optimization with LTO)

2011-03-01  Richard Guenther  <rguenther@suse.de>

	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
This commit is contained in:
Richard Guenther 2011-03-01 09:46:19 +00:00 committed by Richard Biener
parent 06c7edcc27
commit 7a00d9eaf6
4 changed files with 33 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2011-03-01 Richard Guenther <rguenther@suse.de>
PR lto/47924
* lto-streamer.c (lto_record_common_node): Also register
the canonical type.
2011-03-01 Richard Guenther <rguenther@suse.de>
PR lto/46911

View File

@ -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. */

View File

@ -1,3 +1,8 @@
2011-03-01 Richard Guenther <rguenther@suse.de>
PR lto/47924
* gcc.dg/lto/pr47924_0.c: New testcase.
2011-03-01 Richard Guenther <rguenther@suse.de>
PR lto/46911

View File

@ -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;
}