public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix typo in gimple_fold_partial_load_store_mem_ref
@ 2022-11-16  7:29 Kewen.Lin
  2022-11-16 15:36 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Kewen.Lin @ 2022-11-16  7:29 UTC (permalink / raw)
  To: GCC Patches; +Cc: Richard Biener, Robin Dapp

Hi,

As Robin spotted, my recent commit r13-3716 caused an ICE
on s390 if vector access with length is enabled there (his
patch for the enablement hasn't been committed yet).  The
failure is caused by one stupid typo, the bias on s390 is
-1, so the assertion should use tree_fits_shwi_p rather
than tree_fits_uhwi_p.  Thanks for Robin's catching.

I just reproduced the ICE and verified the fix worked fine
with a cross build, the optimized dump against the test case
gcc.target/powerpc/pr107412.c looked expected.

Is it ok for trunk?

BR,
Kewen
-----
gcc/ChangeLog:

	* gimple-fold.cc (gimple_fold_partial_load_store_mem_ref): Use
	tree_fits_shwi_p rather than tree_fits_uhwi_p as bias is signed.
---
 gcc/gimple-fold.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
index 0a212e6d0d4..f8a1875ea3e 100644
--- a/gcc/gimple-fold.cc
+++ b/gcc/gimple-fold.cc
@@ -5392,7 +5392,7 @@ gimple_fold_partial_load_store_mem_ref (gcall *call, tree vectype, bool mask_p)
 	return NULL_TREE;
       unsigned int nargs = gimple_call_num_args (call);
       tree bias = gimple_call_arg (call, nargs - 1);
-      gcc_assert (tree_fits_uhwi_p (bias));
+      gcc_assert (tree_fits_shwi_p (bias));
       tree biased_len = int_const_binop (MINUS_EXPR, basic_len, bias);
       unsigned int len = tree_to_uhwi (biased_len);
       unsigned int vect_len
--
2.25.1

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

* Re: [PATCH] Fix typo in gimple_fold_partial_load_store_mem_ref
  2022-11-16  7:29 [PATCH] Fix typo in gimple_fold_partial_load_store_mem_ref Kewen.Lin
@ 2022-11-16 15:36 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-11-16 15:36 UTC (permalink / raw)
  To: Kewen.Lin; +Cc: GCC Patches, Robin Dapp

On Wed, Nov 16, 2022 at 8:29 AM Kewen.Lin <linkw@linux.ibm.com> wrote:
>
> Hi,
>
> As Robin spotted, my recent commit r13-3716 caused an ICE
> on s390 if vector access with length is enabled there (his
> patch for the enablement hasn't been committed yet).  The
> failure is caused by one stupid typo, the bias on s390 is
> -1, so the assertion should use tree_fits_shwi_p rather
> than tree_fits_uhwi_p.  Thanks for Robin's catching.
>
> I just reproduced the ICE and verified the fix worked fine
> with a cross build, the optimized dump against the test case
> gcc.target/powerpc/pr107412.c looked expected.
>
> Is it ok for trunk?

OK.

> BR,
> Kewen
> -----
> gcc/ChangeLog:
>
>         * gimple-fold.cc (gimple_fold_partial_load_store_mem_ref): Use
>         tree_fits_shwi_p rather than tree_fits_uhwi_p as bias is signed.
> ---
>  gcc/gimple-fold.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
> index 0a212e6d0d4..f8a1875ea3e 100644
> --- a/gcc/gimple-fold.cc
> +++ b/gcc/gimple-fold.cc
> @@ -5392,7 +5392,7 @@ gimple_fold_partial_load_store_mem_ref (gcall *call, tree vectype, bool mask_p)
>         return NULL_TREE;
>        unsigned int nargs = gimple_call_num_args (call);
>        tree bias = gimple_call_arg (call, nargs - 1);
> -      gcc_assert (tree_fits_uhwi_p (bias));
> +      gcc_assert (tree_fits_shwi_p (bias));
>        tree biased_len = int_const_binop (MINUS_EXPR, basic_len, bias);
>        unsigned int len = tree_to_uhwi (biased_len);
>        unsigned int vect_len
> --
> 2.25.1

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

end of thread, other threads:[~2022-11-16 15:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-16  7:29 [PATCH] Fix typo in gimple_fold_partial_load_store_mem_ref Kewen.Lin
2022-11-16 15:36 ` Richard Biener

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).