public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rs6000: Remove redundant initialization [PR106907]
       [not found] <f7c412d0-57d2-1c75-3c8c-c466adb7795e@linux.vnet.ibm.com>
@ 2023-06-07  5:44 ` P Jeevitha
  2023-06-29  9:31   ` Kewen.Lin
  0 siblings, 1 reply; 4+ messages in thread
From: P Jeevitha @ 2023-06-07  5:44 UTC (permalink / raw)
  To: Segher Boessenkool, gcc-patches, Peter Bergner

PR106907 has few warnings spotted from cppcheck. In that addressing
redundant initialization issue. Here the initialized value of 'new_addr'
was overwritten before it was read. Updated the source by removing the
unnecessary initialization of 'new_addr'.

2023-06-07  Jeevitha Palanisamy  <jeevitha@linux.ibm.com>

gcc/
	PR target/106907
	* gcc/config/rs6000/rs6000.cc (rs6000_expand_vector_extract): Remove redundant
	initialization of new_addr.


diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 42f49e4a56b..d994e004bd3 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -7660,12 +7660,11 @@ rs6000_expand_vector_extract (rtx target, rtx vec, rtx elt)
     {
       unsigned int ele_size = GET_MODE_SIZE (inner_mode);
       rtx num_ele_m1 = GEN_INT (GET_MODE_NUNITS (mode) - 1);
-      rtx new_addr = gen_reg_rtx (Pmode);
 
       elt = gen_rtx_AND (Pmode, elt, num_ele_m1);
       if (ele_size > 1)
 	elt = gen_rtx_MULT (Pmode, elt, GEN_INT (ele_size));
-      new_addr = gen_rtx_PLUS (Pmode, XEXP (mem, 0), elt);
+      rtx new_addr = gen_rtx_PLUS (Pmode, XEXP (mem, 0), elt);
       new_addr = change_address (mem, inner_mode, new_addr);
       emit_move_insn (target, new_addr);
     }


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rs6000: Remove redundant initialization [PR106907]
  2023-06-07  5:44 ` [PATCH] rs6000: Remove redundant initialization [PR106907] P Jeevitha
@ 2023-06-29  9:31   ` Kewen.Lin
  2023-07-10 23:11     ` Peter Bergner
  0 siblings, 1 reply; 4+ messages in thread
From: Kewen.Lin @ 2023-06-29  9:31 UTC (permalink / raw)
  To: P Jeevitha; +Cc: Segher Boessenkool, gcc-patches, Peter Bergner

Hi Jeevitha,

on 2023/6/7 13:44, P Jeevitha via Gcc-patches wrote:
> PR106907 has few warnings spotted from cppcheck. In that addressing
> redundant initialization issue. Here the initialized value of 'new_addr'
> was overwritten before it was read. Updated the source by removing the
> unnecessary initialization of 'new_addr'.

This is okay for trunk (no backports needed btw), this fix can even be
taken as obvious, thanks!

> 
> 2023-06-07  Jeevitha Palanisamy  <jeevitha@linux.ibm.com>
> 
> gcc/
> 	PR target/106907

One curious question is that this PR106907 seemed not to report this issue,
is there another PR reporting this?  Or do I miss something?

BR,
Kewen

> 	* gcc/config/rs6000/rs6000.cc (rs6000_expand_vector_extract): Remove redundant
> 	initialization of new_addr.
> 
> 
> diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
> index 42f49e4a56b..d994e004bd3 100644
> --- a/gcc/config/rs6000/rs6000.cc
> +++ b/gcc/config/rs6000/rs6000.cc
> @@ -7660,12 +7660,11 @@ rs6000_expand_vector_extract (rtx target, rtx vec, rtx elt)
>      {
>        unsigned int ele_size = GET_MODE_SIZE (inner_mode);
>        rtx num_ele_m1 = GEN_INT (GET_MODE_NUNITS (mode) - 1);
> -      rtx new_addr = gen_reg_rtx (Pmode);
>  
>        elt = gen_rtx_AND (Pmode, elt, num_ele_m1);
>        if (ele_size > 1)
>  	elt = gen_rtx_MULT (Pmode, elt, GEN_INT (ele_size));
> -      new_addr = gen_rtx_PLUS (Pmode, XEXP (mem, 0), elt);
> +      rtx new_addr = gen_rtx_PLUS (Pmode, XEXP (mem, 0), elt);
>        new_addr = change_address (mem, inner_mode, new_addr);
>        emit_move_insn (target, new_addr);
>      }
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rs6000: Remove redundant initialization [PR106907]
  2023-06-29  9:31   ` Kewen.Lin
@ 2023-07-10 23:11     ` Peter Bergner
  2023-07-11  1:44       ` Kewen.Lin
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Bergner @ 2023-07-10 23:11 UTC (permalink / raw)
  To: Kewen.Lin, P Jeevitha; +Cc: Segher Boessenkool, gcc-patches

On 6/29/23 4:31 AM, Kewen.Lin via Gcc-patches wrote:
> This is okay for trunk (no backports needed btw), this fix can even be
> taken as obvious, thanks!
> 
>>
>> 2023-06-07  Jeevitha Palanisamy  <jeevitha@linux.ibm.com>
>>
>> gcc/
>> 	PR target/106907
> 
> One curious question is that this PR106907 seemed not to report this issue,
> is there another PR reporting this?  Or do I miss something?

I think Jeevitha just ran cppcheck by hand and noticed the "new" warnings
and added them to the list of things to fixup.  Yeah, it would be nice to
add the new warnings to the PR for historical reasons.

Peter




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rs6000: Remove redundant initialization [PR106907]
  2023-07-10 23:11     ` Peter Bergner
@ 2023-07-11  1:44       ` Kewen.Lin
  0 siblings, 0 replies; 4+ messages in thread
From: Kewen.Lin @ 2023-07-11  1:44 UTC (permalink / raw)
  To: Peter Bergner; +Cc: Segher Boessenkool, gcc-patches, P Jeevitha

on 2023/7/11 07:11, Peter Bergner wrote:
> On 6/29/23 4:31 AM, Kewen.Lin via Gcc-patches wrote:
>> This is okay for trunk (no backports needed btw), this fix can even be
>> taken as obvious, thanks!
>>
>>>
>>> 2023-06-07  Jeevitha Palanisamy  <jeevitha@linux.ibm.com>
>>>
>>> gcc/
>>> 	PR target/106907
>>
>> One curious question is that this PR106907 seemed not to report this issue,
>> is there another PR reporting this?  Or do I miss something?
> 
> I think Jeevitha just ran cppcheck by hand and noticed the "new" warnings
> and added them to the list of things to fixup.  Yeah, it would be nice to
> add the new warnings to the PR for historical reasons.

Thanks for clarifying it.  Yeah, I noticed Jeevitha added more comments to
that PR. :)

BR,
Kewen

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-11  1:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <f7c412d0-57d2-1c75-3c8c-c466adb7795e@linux.vnet.ibm.com>
2023-06-07  5:44 ` [PATCH] rs6000: Remove redundant initialization [PR106907] P Jeevitha
2023-06-29  9:31   ` Kewen.Lin
2023-07-10 23:11     ` Peter Bergner
2023-07-11  1:44       ` Kewen.Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).