Apply finish_options on DECL_FUNCTION_SPECIFIC_OPTIMIZATION for ACCEL_COMPILER
authorTom de Vries <tom@codesourcery.com>
Thu, 3 Aug 2017 11:37:55 +0000 (11:37 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Thu, 3 Aug 2017 11:37:55 +0000 (11:37 +0000)
2017-08-03  Tom de Vries  <tom@codesourcery.com>

PR lto/81430
* tree-streamer-in.c (lto_input_ts_function_decl_tree_pointers): If
ACCEL_COMPILER, apply finish_options on
DECL_FUNCTION_SPECIFIC_OPTIMIZATION.

From-SVN: r250852

gcc/ChangeLog
gcc/tree-streamer-in.c

index 0449bfc13d69c97a223995e7aba27b1799f32230..d2cd6b41888029a5c9ce6bfe4ea75aca4c4a8b3b 100644 (file)
@@ -1,3 +1,10 @@
+2017-08-03  Tom de Vries  <tom@codesourcery.com>
+
+       PR lto/81430
+       * tree-streamer-in.c (lto_input_ts_function_decl_tree_pointers): If
+       ACCEL_COMPILER, apply finish_options on
+       DECL_FUNCTION_SPECIFIC_OPTIMIZATION.
+
 2017-08-03  Tom de Vries  <tom@codesourcery.com>
 
        PR target/81662
index d7b6d224ab55dfef60b9651100a619a535e3c3c0..eb41e7556d00a2d09b2c6e07bdbfddd92edf2ec6 100644 (file)
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "ipa-chkp.h"
 #include "gomp-constants.h"
 #include "asan.h"
+#include "opts.h"
 
 
 /* Read a STRING_CST from the string table in DATA_IN using input
@@ -769,6 +770,21 @@ lto_input_ts_function_decl_tree_pointers (struct lto_input_block *ib,
   DECL_FUNCTION_SPECIFIC_TARGET (expr) = stream_read_tree (ib, data_in);
 #endif
   DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr) = stream_read_tree (ib, data_in);
+#ifdef ACCEL_COMPILER
+  {
+    tree opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr);
+    if (opts)
+      {
+       struct gcc_options tmp;
+       init_options_struct (&tmp, NULL);
+       cl_optimization_restore (&tmp, TREE_OPTIMIZATION (opts));
+       finish_options (&tmp, &global_options_set, UNKNOWN_LOCATION);
+       opts = build_optimization_node (&tmp);
+       finalize_options_struct (&tmp);
+       DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr) = opts;
+      }
+  }
+#endif
 
   /* If the file contains a function with an EH personality set,
      then it was compiled with -fexceptions.  In that case, initialize