This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix streaming of target optimization/option nodes
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: Richard Biener <rguenther at suse dot de>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 15 Dec 2014 23:36:11 +0100
- Subject: Re: Fix streaming of target optimization/option nodes
- Authentication-results: sourceware.org; auth=none
- References: <20141215062619 dot GB11373 at kam dot mff dot cuni dot cz> <20141215074919 dot GA16783 at kam dot mff dot cuni dot cz> <alpine dot LSU dot 2 dot 11 dot 1412150930410 dot 25296 at zhemvz dot fhfr dot qr> <20141215215618 dot GB6931 at kam dot mff dot cuni dot cz>
Hi,
this is final version I comitted. 20110201-1_0.c actually tests that we
optimize cabs on function copmiled with -O0 that is no longer supposed to
happen.
Honza
PR lto/64043
* gcc.dg/lto/20110201-1_0.c: New testcase.
* tree-streamer.c (preload_common_nodes): Skip preloading
of main_identifier_node, pid_type and optimization/option nodes.
Index: testsuite/gcc.dg/lto/20110201-1_0.c
===================================================================
--- testsuite/gcc.dg/lto/20110201-1_0.c (revision 218726)
+++ testsuite/gcc.dg/lto/20110201-1_0.c (working copy)
@@ -1,6 +1,5 @@
/* { dg-lto-do run } */
/* { dg-lto-options { { -O0 -flto } } } */
-/* { dg-extra-ld-options "-O2 -ffast-math -fuse-linker-plugin" } */
/* { dg-require-linker-plugin "" } */
/* We require a linker plugin because otherwise we'd need to link
@@ -9,7 +8,7 @@
which does not have folded cabs. */
double cabs(_Complex double);
-double __attribute__((used))
+double __attribute__((used)) __attribute__ ((optimize ("O2,fast-math")))
foo (_Complex double x, int b)
{
if (b)
Index: tree-streamer.c
===================================================================
--- tree-streamer.c (revision 218726)
+++ tree-streamer.c (working copy)
@@ -324,7 +324,18 @@ preload_common_nodes (struct streamer_tr
/* Skip boolean type and constants, they are frontend dependent. */
if (i != TI_BOOLEAN_TYPE
&& i != TI_BOOLEAN_FALSE
- && i != TI_BOOLEAN_TRUE)
+ && i != TI_BOOLEAN_TRUE
+ /* MAIN_IDENTIFIER is not always initialized by Fortran FE. */
+ && i != TI_MAIN_IDENTIFIER
+ /* PID_TYPE is initialized only by C family front-ends. */
+ && i != TI_PID_TYPE
+ /* Skip optimization and target option nodes; they depend on flags. */
+ && i != TI_OPTIMIZATION_DEFAULT
+ && i != TI_OPTIMIZATION_CURRENT
+ && i != TI_TARGET_OPTION_DEFAULT
+ && i != TI_TARGET_OPTION_CURRENT
+ && i != TI_CURRENT_TARGET_PRAGMA
+ && i != TI_CURRENT_OPTIMIZE_PRAGMA)
record_common_node (cache, global_trees[i]);
}