[Patch, trivial?] PR 41974: Remove some "write-only" variables

View: New views
4 Messages — Rating Filter:   Alert me  

[Patch, trivial?] PR 41974: Remove some "write-only" variables

by Paolo Carlini-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I think this one qualifies as obvious. Tested C/C++ on x86_64-linux, anyway.

Ok for mainline?

Paolo.

////////////////////

2009-11-06  Paolo Carlini  <paolo.carlini@...>

        PR c/41974
        * builtins.c (expand_builtin_mathfn, expand_powi,
        expand_builtin_expect): Remove "write-only" variables.
        * genautomata.c (check_regexp_units_distribution): Likewise.


Index: builtins.c
===================================================================
--- builtins.c (revision 153973)
+++ builtins.c (working copy)
@@ -1924,7 +1924,7 @@ static rtx
 expand_builtin_mathfn (tree exp, rtx target, rtx subtarget)
 {
   optab builtin_optab;
-  rtx op0, insns, before_call;
+  rtx op0, insns;
   tree fndecl = get_callee_fndecl (exp);
   enum machine_mode mode;
   bool errno_set = false;
@@ -2031,8 +2031,6 @@ expand_builtin_mathfn (tree exp, rtx target, rtx s
       end_sequence ();
     }
 
-  before_call = get_last_insn ();
-
   return expand_call (exp, target, target == const0_rtx);
 }
 
@@ -2903,15 +2901,12 @@ expand_powi_1 (enum machine_mode mode, unsigned HO
 static rtx
 expand_powi (rtx x, enum machine_mode mode, HOST_WIDE_INT n)
 {
-  unsigned HOST_WIDE_INT val;
   rtx cache[POWI_TABLE_SIZE];
   rtx result;
 
   if (n == 0)
     return CONST1_RTX (mode);
 
-  val = (n < 0) ? -n : n;
-
   memset (cache, 0, sizeof (cache));
   cache[1] = x;
 
@@ -4893,12 +4888,11 @@ expand_builtin_unop (enum machine_mode target_mode
 static rtx
 expand_builtin_expect (tree exp, rtx target)
 {
-  tree arg, c;
+  tree arg;
 
   if (call_expr_nargs (exp) < 2)
     return const0_rtx;
   arg = CALL_EXPR_ARG (exp, 0);
-  c = CALL_EXPR_ARG (exp, 1);
 
   target = expand_expr (arg, target, VOIDmode, EXPAND_NORMAL);
   /* When guessing was done, the hints should be already stripped away.  */
Index: genautomata.c
===================================================================
--- genautomata.c (revision 153973)
+++ genautomata.c (working copy)
@@ -5045,7 +5045,7 @@ static void
 check_regexp_units_distribution (const char *insn_reserv_name,
  regexp_t regexp)
 {
-  int i, j, k, cycle, cycle2, start, n_alts, alt, alt2;
+  int i, j, k, cycle, start, n_alts, alt, alt2;
   bool annotation_reservation_message_reported_p;
   regexp_t seq, allof, unit;
   struct unit_usage *unit_usage_ptr;
@@ -5164,7 +5164,6 @@ check_regexp_units_distribution (const char *insn_
    j < (int) VEC_length (unit_usage_t, cycle_alt_unit_usages);
    j++)
  {
-  cycle2 = j / n_alts;
   alt2 = j % n_alts;
   if (! unit_present_on_list_p
         (VEC_index (unit_usage_t, cycle_alt_unit_usages,

Re: [Patch, trivial?] PR 41974: Remove some "write-only" variables

by Richard Guenther-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Nov 7, 2009 at 1:58 AM, Paolo Carlini <paolo.carlini@...> wrote:
> Hi,
>
> I think this one qualifies as obvious. Tested C/C++ on x86_64-linux, anyway.
>
> Ok for mainline?

Ok.

Thanks,
Richard.

> Paolo.
>
> ////////////////////
>
> 2009-11-06  Paolo Carlini  <paolo.carlini@...>
>
>        PR c/41974
>        * builtins.c (expand_builtin_mathfn, expand_powi,
>        expand_builtin_expect): Remove "write-only" variables.
>        * genautomata.c (check_regexp_units_distribution): Likewise.
>
>
> Index: builtins.c
> ===================================================================
> --- builtins.c  (revision 153973)
> +++ builtins.c  (working copy)
> @@ -1924,7 +1924,7 @@ static rtx
>  expand_builtin_mathfn (tree exp, rtx target, rtx subtarget)
>  {
>   optab builtin_optab;
> -  rtx op0, insns, before_call;
> +  rtx op0, insns;
>   tree fndecl = get_callee_fndecl (exp);
>   enum machine_mode mode;
>   bool errno_set = false;
> @@ -2031,8 +2031,6 @@ expand_builtin_mathfn (tree exp, rtx target, rtx s
>       end_sequence ();
>     }
>
> -  before_call = get_last_insn ();
> -
>   return expand_call (exp, target, target == const0_rtx);
>  }
>
> @@ -2903,15 +2901,12 @@ expand_powi_1 (enum machine_mode mode, unsigned HO
>  static rtx
>  expand_powi (rtx x, enum machine_mode mode, HOST_WIDE_INT n)
>  {
> -  unsigned HOST_WIDE_INT val;
>   rtx cache[POWI_TABLE_SIZE];
>   rtx result;
>
>   if (n == 0)
>     return CONST1_RTX (mode);
>
> -  val = (n < 0) ? -n : n;
> -
>   memset (cache, 0, sizeof (cache));
>   cache[1] = x;
>
> @@ -4893,12 +4888,11 @@ expand_builtin_unop (enum machine_mode target_mode
>  static rtx
>  expand_builtin_expect (tree exp, rtx target)
>  {
> -  tree arg, c;
> +  tree arg;
>
>   if (call_expr_nargs (exp) < 2)
>     return const0_rtx;
>   arg = CALL_EXPR_ARG (exp, 0);
> -  c = CALL_EXPR_ARG (exp, 1);
>
>   target = expand_expr (arg, target, VOIDmode, EXPAND_NORMAL);
>   /* When guessing was done, the hints should be already stripped away.  */
> Index: genautomata.c
> ===================================================================
> --- genautomata.c       (revision 153973)
> +++ genautomata.c       (working copy)
> @@ -5045,7 +5045,7 @@ static void
>  check_regexp_units_distribution (const char *insn_reserv_name,
>                                 regexp_t regexp)
>  {
> -  int i, j, k, cycle, cycle2, start, n_alts, alt, alt2;
> +  int i, j, k, cycle, start, n_alts, alt, alt2;
>   bool annotation_reservation_message_reported_p;
>   regexp_t seq, allof, unit;
>   struct unit_usage *unit_usage_ptr;
> @@ -5164,7 +5164,6 @@ check_regexp_units_distribution (const char *insn_
>                   j < (int) VEC_length (unit_usage_t, cycle_alt_unit_usages);
>                   j++)
>                {
> -                 cycle2 = j / n_alts;
>                  alt2 = j % n_alts;
>                  if (! unit_present_on_list_p
>                        (VEC_index (unit_usage_t, cycle_alt_unit_usages,
>
>

Re: [Patch, trivial?] PR 41974: Remove some "write-only" variables

by Paolo Carlini-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> Ok.

Thanks Richard. This one obsoletes it, includes a couple additional  
removals:

http://gcc.gnu.org/ml/gcc-patches/2009-11/msg00396.html

I would rather regtest the latter again at my end, to be safe, and  
commit. Is that ok with you?

Paolo

Re: [Patch, trivial?] PR 41974: Remove some "write-only" variables

by Richard Guenther-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Nov 7, 2009 at 7:03 PM, Paolo Carlini <paolo.carlini@...> wrote:

>
>> Ok.
>
> Thanks Richard. This one obsoletes it, includes a couple additional
> removals:
>
> http://gcc.gnu.org/ml/gcc-patches/2009-11/msg00396.html
>
> I would rather regtest the latter again at my end, to be safe, and commit.
> Is that ok with you?

Sure.

Thanks,
Richard.