On Fri, Aug 02, 2024 at 11:58:19AM +0000, Prathamesh Kulkarni wrote: > diff --git a/gcc/data-streamer-in.cc b/gcc/data-streamer-in.cc > index 7dce2928ef0..7b9d8cc0129 100644 > --- a/gcc/data-streamer-in.cc > +++ b/gcc/data-streamer-in.cc > @@ -182,10 +182,8 @@ streamer_read_hwi (class lto_input_block *ib) > poly_uint64 > streamer_read_poly_uint64 (class lto_input_block *ib) > { > - poly_uint64 res; > - for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i) > - res.coeffs[i] = streamer_read_uhwi (ib); > - return res; > + return poly_int_read_common<poly_int_traits<poly_uint64>::coeff_type> > + (streamer_read_uhwi, ib);
Can't you use using coeff_type = poly_int_traits <poly_uint64>::coeff_type; return poly_int_read_common <coeff_type> (streamer_read_uhwi, ib); ? The call arguments on different line from the actual function name are ugly. > --- a/gcc/data-streamer.cc > +++ b/gcc/data-streamer.cc > @@ -28,6 +28,12 @@ along with GCC; see the file COPYING3. If not see > #include "cgraph.h" > #include "data-streamer.h" > > +/* For offloading -- While streaming-out, host NUM_POLY_INT_COEFFS is > + stored at beginning of mode_table. While streaming-in, the value is read > in > + host_num_poly_int_coeffs. */ > + > +unsigned host_num_poly_int_coeffs = 0; I think it would be better to guard this with #ifdef ACCEL_COMPILER. > +template<typename C, typename F, typename ...Args> > +poly_int<NUM_POLY_INT_COEFFS, C> > +poly_int_read_common (F read_coeff, Args ...args) > +{ > + poly_int<NUM_POLY_INT_COEFFS, C> x; > + unsigned i; > + > +#ifndef ACCEL_COMPILER > + host_num_poly_int_coeffs = NUM_POLY_INT_COEFFS; > +#endif And instead of modifying a global var again and again do #ifdef ACCEL_COMPILER const unsigned num_poly_int_coeffs = host_num_poly_int_coeffs; gcc_assert (num_poly_int_coeffs > 0); #else const unsigned num_poly_int_coeffs = NUM_POLY_INT_COEFFS; #endif and use num_poly_int_coeffs in the functions. Jakub