public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] LTO: Get rid of 'lto_mode_identity_table'
@ 2023-09-26 15:10 Jeff Law
  0 siblings, 0 replies; only message in thread
From: Jeff Law @ 2023-09-26 15:10 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0e3228b8602523e1ea17277a1d069ad8b9ff05c5

commit 0e3228b8602523e1ea17277a1d069ad8b9ff05c5
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Thu Aug 10 15:23:37 2023 +0200

    LTO: Get rid of 'lto_mode_identity_table'
    
    This, in particular, resolves LTO ICEs with big 'machine_mode's, as for RISC-V.
    ('mode_table' in 'lto_file_decl_data' still is 'unsigned char'; changing that
    is still to be done (for use in offloading compilation), but is not trivial.)
    For now, get rid of 'lto_mode_identity_table' to resolve the RISC-V LTO ICEs;
    we don't need an actual table for a 1-to-1 mapping.
    
            gcc/lto/
            * lto-common.cc (lto_mode_identity_table): Remove.
            (lto_file_finalize) [!ACCEL_COMPILER]: 'NULL'-intialize
            'file_data->mode_table'.
            (lto_fe_init): Don't initialize 'lto_mode_identity_table'.
            * lto-common.h (lto_mode_identity_table): Remove.
            gcc/
            * tree-streamer.h (bp_unpack_machine_mode): If
            'ib->file_data->mode_table' not available, apply 1-to-1 mapping.
    
    Co-authored-by: Pan Li <pan2.li@intel.com>
    (cherry picked from commit c81d9b9fabaea25950a5fea91e4f541077078087)

Diff:
---
 gcc/lto/lto-common.cc | 11 +----------
 gcc/lto/lto-common.h  |  1 -
 gcc/tree-streamer.h   |  5 ++++-
 3 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc
index 2c32fe757e0..efbb23c6e24 100644
--- a/gcc/lto/lto-common.cc
+++ b/gcc/lto/lto-common.cc
@@ -64,8 +64,6 @@ static bool type_streaming_finished = false;
 
 GTY(()) tree first_personality_decl;
 
-GTY(()) const unsigned char *lto_mode_identity_table;
-
 /* Returns a hash code for P.  */
 
 static hashval_t
@@ -2274,7 +2272,7 @@ lto_file_finalize (struct lto_file_decl_data *file_data, lto_file *file,
 #ifdef ACCEL_COMPILER
   lto_input_mode_table (file_data);
 #else
-  file_data->mode_table = lto_mode_identity_table;
+  file_data->mode_table = NULL;
   file_data->mode_bits = ceil_log2 (MAX_MACHINE_MODE);
 #endif
 
@@ -3115,13 +3113,6 @@ lto_fe_init (void)
   memset (&lto_stats, 0, sizeof (lto_stats));
   bitmap_obstack_initialize (NULL);
   gimple_register_cfg_hooks ();
-#ifndef ACCEL_COMPILER
-  unsigned char *table
-    = ggc_vec_alloc<unsigned char> (MAX_MACHINE_MODE);
-  for (int m = 0; m < MAX_MACHINE_MODE; m++)
-    table[m] = m;
-  lto_mode_identity_table = table;
-#endif
 }
 
 #include "gt-lto-lto-common.h"
diff --git a/gcc/lto/lto-common.h b/gcc/lto/lto-common.h
index 24b2445673b..b9faa72e5cb 100644
--- a/gcc/lto/lto-common.h
+++ b/gcc/lto/lto-common.h
@@ -26,7 +26,6 @@ void print_lto_report_1 (void);
 
 extern tree lto_eh_personality_decl;
 extern GTY(()) vec<tree, va_gc> *tree_with_vars;
-extern const unsigned char *lto_mode_identity_table;
 extern tree first_personality_decl;
 
 #endif
diff --git a/gcc/tree-streamer.h b/gcc/tree-streamer.h
index ff49d1ba637..886ee6ac754 100644
--- a/gcc/tree-streamer.h
+++ b/gcc/tree-streamer.h
@@ -118,7 +118,10 @@ bp_unpack_machine_mode (struct bitpack_d *bp)
   lto_input_block *ib = (class lto_input_block *) bp->stream;
   int last = 1 << ib->file_data->mode_bits;
   unsigned ix = bp_unpack_enum (bp, machine_mode, last);
-  return (machine_mode) ib->file_data->mode_table[ix];
+  if (ib->file_data->mode_table)
+    return (machine_mode) ib->file_data->mode_table[ix];
+  else
+    return (machine_mode) ix;
 }
 
 #endif  /* GCC_TREE_STREAMER_H  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-26 15:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-26 15:10 [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] LTO: Get rid of 'lto_mode_identity_table' Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).