* [PATCH] tree-optimization/105629 - spaceship recognition regression
@ 2022-05-23 10:53 Richard Biener
2022-05-23 16:27 ` Jakub Jelinek
0 siblings, 1 reply; 2+ messages in thread
From: Richard Biener @ 2022-05-23 10:53 UTC (permalink / raw)
To: gcc-patches; +Cc: Jakub Jelinek
With the extra GENERIC folding we now do to
(unsigned int) __v._M_value & 1 != (unsigned int) __v._M_value
we end up with a sign-extending conversion to unsigned int
rather than the sign-conversion to unsigned char we expect.
Relaxing that fixes the regression.
Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?
Thanks,
Richard.
2022-05-23 Richard Biener <rguenther@suse.de>
PR tree-optimization/105629
* tree-ssa-phiopt.cc (spaceship_replacement): Allow
a sign-extending conversion.
---
gcc/tree-ssa-phiopt.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index 8c9c46d41f1..e61d9736937 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -2217,7 +2217,7 @@ spaceship_replacement (basic_block cond_bb, basic_block middle_bb,
if (!TYPE_UNSIGNED (ty2) || !INTEGRAL_TYPE_P (ty2))
return false;
- if (TYPE_PRECISION (ty1) != TYPE_PRECISION (ty2))
+ if (TYPE_PRECISION (ty1) > TYPE_PRECISION (ty2))
return false;
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig_use_lhs))
return false;
--
2.35.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] tree-optimization/105629 - spaceship recognition regression
2022-05-23 10:53 [PATCH] tree-optimization/105629 - spaceship recognition regression Richard Biener
@ 2022-05-23 16:27 ` Jakub Jelinek
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2022-05-23 16:27 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
On Mon, May 23, 2022 at 12:53:37PM +0200, Richard Biener wrote:
> With the extra GENERIC folding we now do to
> (unsigned int) __v._M_value & 1 != (unsigned int) __v._M_value
> we end up with a sign-extending conversion to unsigned int
> rather than the sign-conversion to unsigned char we expect.
> Relaxing that fixes the regression.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?
>
> Thanks,
> Richard.
>
> 2022-05-23 Richard Biener <rguenther@suse.de>
>
> PR tree-optimization/105629
> * tree-ssa-phiopt.cc (spaceship_replacement): Allow
> a sign-extending conversion.
> ---
> gcc/tree-ssa-phiopt.cc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
> index 8c9c46d41f1..e61d9736937 100644
> --- a/gcc/tree-ssa-phiopt.cc
> +++ b/gcc/tree-ssa-phiopt.cc
> @@ -2217,7 +2217,7 @@ spaceship_replacement (basic_block cond_bb, basic_block middle_bb,
>
> if (!TYPE_UNSIGNED (ty2) || !INTEGRAL_TYPE_P (ty2))
> return false;
> - if (TYPE_PRECISION (ty1) != TYPE_PRECISION (ty2))
> + if (TYPE_PRECISION (ty1) > TYPE_PRECISION (ty2))
> return false;
> if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig_use_lhs))
> return false;
LGTM, thanks.
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-23 16:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23 10:53 [PATCH] tree-optimization/105629 - spaceship recognition regression Richard Biener
2022-05-23 16:27 ` Jakub Jelinek
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).