[patch] sort and group case labels

Steven Bosscher stevenb@suse.de
Thu May 27 00:14:00 GMT 2004


On Wednesday 26 May 2004 20:52, Richard Henderson wrote:
> On Wed, May 26, 2004 at 12:06:58AM +0200, Steven Bosscher wrote:
> > + 		  /* Merge the cases if they jump to the same place,
> > + 		     and their ranges are consecutive.  */
> > + 		  if (merge_label == base_label
> > + 		      && tree_int_cst_equal (CASE_LOW (merge_case),
> > + 					     fold (build (PLUS_EXPR, type,
> > + 					     		  base_high,
> > + 							  integer_one_node)))
> > + 		      /* An overflow is not consecutive.  */
> > + 		      && tree_int_cst_lt (base_high,
> > + 					  fold (build (PLUS_EXPR, type,
> > + 						       base_high,
> > + 						       integer_one_node))))
>
> Use int_const_binop instead, and use it only once.

OK.

> > + 	  /* Copy the grouped old case labels into the new label vector,
> > + 	     and replace the old label vector in this switch statement.  */
> > + 	  new_labels = make_tree_vec (new_size);
>
> Why allocating a new vector rather than compressing the existing?
> Can modify TREE_VEC_LENGTH.

I didn't know one could do that.

Take 2 attached, same bootstrap, same testing, same ChangeLog.

Gr.
Steven


-------------- next part --------------
A non-text attachment was scrubbed...
Name: sort_switch_1.diff
Type: text/x-diff
Size: 12821 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20040527/1f20eb15/attachment.bin>


More information about the Gcc-patches mailing list