On Tue, Jun 13, 2017 at 12:14 PM, Richard Biener <richard.guent...@gmail.com> wrote: > On Mon, Jun 12, 2017 at 7:02 PM, Bin Cheng <bin.ch...@arm.com> wrote: >> Hi, >> This patch collects and preserves all data references in loop for whole >> distribution life time. It will be used afterwards. >> >> Bootstrap and test on x86_64 and AArch64. Is it OK? > > +/* Vector of data references in the loop to be distributed. */ > +static vec<data_reference_p> *datarefs_vec; > + > +/* Map of data reference in the loop to a unique id. */ > +static hash_map<data_reference_p, int> *datarefs_map; > + > > no need to make those pointers. It's not a unique id but > the index into the datarefs_vec vector, right? > > loop distribution doesn't yet use dr->aux so it would be nice > to avoid the hash_map in favor of using that field. > > #define DR_INDEX (dr) ((uintptr_t)(dr)->aux) > > + if (datarefs_vec->length () > 64) > > There is PARAM_VALUE (PARAM_LOOP_MAX_DATAREFS_FOR_DATADEPS) > with a default value of 1000. Please use that instead of magic numbers. > > + { > + if (dump_file && (dump_flags & TDF_DETAILS)) > + fprintf (dump_file, > + "Loop %d not distributed: more than 64 memory references.\n", > + loop->num); > + > + free_rdg (rdg); > + loop_nest->release (); > + delete loop_nest; > + free_data_refs (*datarefs_vec); > + delete datarefs_vec; > + return 0; > + } > > auto_* were so nice ... Hi Richard, This is the updated patch. It removes datarefs_map as well as checks number of data references against the parameter. Is it OK?
Thanks, bin 2017-06-07 Bin Cheng <bin.ch...@arm.com> * tree-loop-distribution.c (params.h): Include header file. (MAX_DATAREFS_NUM, DR_INDEX): New macro. (datarefs_vec): New global var. (create_rdg_vertices): Use datarefs_vec directly. (free_rdg): Don't free data references. (build_rdg): Update use. Don't free data references. (distribute_loop): Compute global variable for data references. Bail out if there are too many data references.