This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Remove superfluous variable in expand_end_case



This obvious patch removes a unnecessary variable, orig_minval, from
expand_end_case in stmt.c.  This simplifies the following patch that
improves code generation for switch statements.  The local variable
minval is never modified or passed by reference, so the copy orig_minval
shouldn't be required.  As this patch is potentially obvious and
independent, I thought I'd submit it independently.

Bootstraped on i686-pc-linux-gnu with no regressions.


2001-10-24  Roger Sayle <roger@eyesopen.com>

        * stmt.c (expand_end_case): Remove superfluous variable
	orig_minval.



*** stmt.c	2001/10/18 21:34:14	1.221
--- stmt.c	2001/10/23 20:18:56
*************** void
*** 5316,5322 ****
  expand_end_case (orig_index)
       tree orig_index;
  {
!   tree minval = NULL_TREE, maxval = NULL_TREE, range = NULL_TREE, orig_minval;
    rtx default_label = 0;
    struct case_node *n;
    unsigned int count;
--- 5316,5322 ----
  expand_end_case (orig_index)
       tree orig_index;
  {
!   tree minval = NULL_TREE, maxval = NULL_TREE, range = NULL_TREE;
    rtx default_label = 0;
    struct case_node *n;
    unsigned int count;
*************** expand_end_case (orig_index)
*** 5416,5423 ****
  	    count++;
  	}

-       orig_minval = minval;
-
        /* Compute span of values.  */
        if (count != 0)
  	range = fold (build (MINUS_EXPR, index_type, maxval, minval));
--- 5416,5421 ----
*************** expand_end_case (orig_index)
*** 5547,5559 ****
  	  for (n = thiscase->data.case_stmt.case_list; n; n = n->right)
  	    {
  	      HOST_WIDE_INT i
! 		= TREE_INT_CST_LOW (n->low) - TREE_INT_CST_LOW (orig_minval);

  	      while (1)
  		{
  		  labelvec[i]
  		    = gen_rtx_LABEL_REF (Pmode, label_rtx (n->code_label));
! 		  if (i + TREE_INT_CST_LOW (orig_minval)
  		      == TREE_INT_CST_LOW (n->high))
  		    break;
  		  i++;
--- 5545,5557 ----
  	  for (n = thiscase->data.case_stmt.case_list; n; n = n->right)
  	    {
  	      HOST_WIDE_INT i
! 		= TREE_INT_CST_LOW (n->low) - TREE_INT_CST_LOW (minval);

  	      while (1)
  		{
  		  labelvec[i]
  		    = gen_rtx_LABEL_REF (Pmode, label_rtx (n->code_label));
! 		  if (i + TREE_INT_CST_LOW (minval)
  		      == TREE_INT_CST_LOW (n->high))
  		    break;
  		  i++;

--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-438-3470



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]