public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] sccvn: Correct the index of bias for IFN_LEN_STORE [PR110744]
@ 2023-07-20 10:16 Kewen.Lin
  2023-07-20 12:37 ` Richard Sandiford
  0 siblings, 1 reply; 3+ messages in thread
From: Kewen.Lin @ 2023-07-20 10:16 UTC (permalink / raw)
  To: GCC Patches; +Cc: Richard Biener, Richard Sandiford, juzhe.zhong, Li, Pan2

Hi,

Commit r14-2267-gb8806f6ffbe72e adjusts the arguments order
of LEN_STORE from {len,vector,bias} to {len,bias,vector},
in order to make them consistent with LEN_MASK_STORE and
MASK_STORE.  But it missed to update the related handlings
in tree-ssa-sccvn.cc, it caused the failure shown in PR
110744.  This patch is to fix the related handlings with
the correct index.

Bootstrapped and regress-tested on x86_64-redhat-linux,
powerpc64-linux-gnu P8/P9 and powerpc64le-linux-gnu P9/P10.

Is it ok for trunk?

BR,
Kewen
-----
	PR tree-optimization/110744

gcc/ChangeLog:

	* tree-ssa-sccvn.cc (vn_reference_lookup_3): Correct the index of bias
	operand for ifn IFN_LEN_STORE.
---
 gcc/tree-ssa-sccvn.cc | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index 11061a374a2..c0b3ec420c5 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -3299,11 +3299,14 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_,
 	    return (void *)-1;
 	  break;
 	case IFN_LEN_STORE:
-	  len = gimple_call_arg (call, 2);
-	  bias = gimple_call_arg (call, 4);
-	  if (!tree_fits_uhwi_p (len) || !tree_fits_shwi_p (bias))
-	    return (void *)-1;
-	  break;
+	  {
+	    int len_index = internal_fn_len_index (fn);
+	    len = gimple_call_arg (call, len_index);
+	    bias = gimple_call_arg (call, len_index + 1);
+	    if (!tree_fits_uhwi_p (len) || !tree_fits_shwi_p (bias))
+	      return (void *) -1;
+	    break;
+	  }
 	default:
 	  return (void *)-1;
 	}
--
2.39.3

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

* Re: [PATCH] sccvn: Correct the index of bias for IFN_LEN_STORE [PR110744]
  2023-07-20 10:16 [PATCH] sccvn: Correct the index of bias for IFN_LEN_STORE [PR110744] Kewen.Lin
@ 2023-07-20 12:37 ` Richard Sandiford
  2023-07-21  5:23   ` Kewen.Lin
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Sandiford @ 2023-07-20 12:37 UTC (permalink / raw)
  To: Kewen.Lin; +Cc: GCC Patches, Richard Biener, juzhe.zhong, Li, Pan2

"Kewen.Lin" <linkw@linux.ibm.com> writes:
> Hi,
>
> Commit r14-2267-gb8806f6ffbe72e adjusts the arguments order
> of LEN_STORE from {len,vector,bias} to {len,bias,vector},
> in order to make them consistent with LEN_MASK_STORE and
> MASK_STORE.  But it missed to update the related handlings
> in tree-ssa-sccvn.cc, it caused the failure shown in PR
> 110744.  This patch is to fix the related handlings with
> the correct index.
>
> Bootstrapped and regress-tested on x86_64-redhat-linux,
> powerpc64-linux-gnu P8/P9 and powerpc64le-linux-gnu P9/P10.
>
> Is it ok for trunk?
>
> BR,
> Kewen
> -----
> 	PR tree-optimization/110744
>
> gcc/ChangeLog:
>
> 	* tree-ssa-sccvn.cc (vn_reference_lookup_3): Correct the index of bias
> 	operand for ifn IFN_LEN_STORE.

OK, thanks.

Richard

> ---
>  gcc/tree-ssa-sccvn.cc | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
> index 11061a374a2..c0b3ec420c5 100644
> --- a/gcc/tree-ssa-sccvn.cc
> +++ b/gcc/tree-ssa-sccvn.cc
> @@ -3299,11 +3299,14 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_,
>  	    return (void *)-1;
>  	  break;
>  	case IFN_LEN_STORE:
> -	  len = gimple_call_arg (call, 2);
> -	  bias = gimple_call_arg (call, 4);
> -	  if (!tree_fits_uhwi_p (len) || !tree_fits_shwi_p (bias))
> -	    return (void *)-1;
> -	  break;
> +	  {
> +	    int len_index = internal_fn_len_index (fn);
> +	    len = gimple_call_arg (call, len_index);
> +	    bias = gimple_call_arg (call, len_index + 1);
> +	    if (!tree_fits_uhwi_p (len) || !tree_fits_shwi_p (bias))
> +	      return (void *) -1;
> +	    break;
> +	  }
>  	default:
>  	  return (void *)-1;
>  	}
> --
> 2.39.3

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

* Re: [PATCH] sccvn: Correct the index of bias for IFN_LEN_STORE [PR110744]
  2023-07-20 12:37 ` Richard Sandiford
@ 2023-07-21  5:23   ` Kewen.Lin
  0 siblings, 0 replies; 3+ messages in thread
From: Kewen.Lin @ 2023-07-21  5:23 UTC (permalink / raw)
  To: richard.sandiford; +Cc: Richard Biener, juzhe.zhong, Li, Pan2, GCC Patches

on 2023/7/20 20:37, Richard Sandiford wrote:
> "Kewen.Lin" <linkw@linux.ibm.com> writes:
>> Hi,
>>
>> Commit r14-2267-gb8806f6ffbe72e adjusts the arguments order
>> of LEN_STORE from {len,vector,bias} to {len,bias,vector},
>> in order to make them consistent with LEN_MASK_STORE and
>> MASK_STORE.  But it missed to update the related handlings
>> in tree-ssa-sccvn.cc, it caused the failure shown in PR
>> 110744.  This patch is to fix the related handlings with
>> the correct index.
>>
>> Bootstrapped and regress-tested on x86_64-redhat-linux,
>> powerpc64-linux-gnu P8/P9 and powerpc64le-linux-gnu P9/P10.
>>
>> Is it ok for trunk?
>>
>> BR,
>> Kewen
>> -----
>> 	PR tree-optimization/110744
>>
>> gcc/ChangeLog:
>>
>> 	* tree-ssa-sccvn.cc (vn_reference_lookup_3): Correct the index of bias
>> 	operand for ifn IFN_LEN_STORE.
> 
> OK, thanks.
> 

Thanks Richard!  Pushed as r14-2694.

BR,
Kewen

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

end of thread, other threads:[~2023-07-21  5:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-20 10:16 [PATCH] sccvn: Correct the index of bias for IFN_LEN_STORE [PR110744] Kewen.Lin
2023-07-20 12:37 ` Richard Sandiford
2023-07-21  5:23   ` 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).