* [PATCH] ipa-strub: Fix handling of _BitInt returns [PR113406]
@ 2024-01-17 9:44 Jakub Jelinek
2024-01-17 12:09 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2024-01-17 9:44 UTC (permalink / raw)
To: Richard Biener, Alexandre Oliva; +Cc: gcc-patches
Hi!
Seems pass_ipa_strub::execute contains a copy of the expand_thunk
code I've changed for _BitInt in r14-6805 PR112941 - larger _BitInts
are aggregate_value_p even when they are is_gimple_reg_type.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk?
2024-01-17 Jakub Jelinek <jakub@redhat.com>
PR middle-end/113406
* ipa-strub.cc (pass_ipa_strub::execute): Check aggregate_value_p
regardless of whether is_gimple_reg_type (restype) or not.
* gcc.dg/bitint-70.c: New test.
--- gcc/ipa-strub.cc.jj 2024-01-03 11:51:28.374775006 +0100
+++ gcc/ipa-strub.cc 2024-01-16 10:51:03.987463928 +0100
@@ -3174,21 +3174,16 @@ pass_ipa_strub::execute (function *)
resdecl,
build_int_cst (TREE_TYPE (resdecl), 0));
}
- else if (!is_gimple_reg_type (restype))
+ else if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl)))
{
- if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl)))
- {
- restmp = resdecl;
+ restmp = resdecl;
- if (VAR_P (restmp))
- {
- add_local_decl (cfun, restmp);
- BLOCK_VARS (DECL_INITIAL (current_function_decl))
- = restmp;
- }
+ if (VAR_P (restmp))
+ {
+ add_local_decl (cfun, restmp);
+ BLOCK_VARS (DECL_INITIAL (current_function_decl))
+ = restmp;
}
- else
- restmp = create_tmp_var (restype, "retval");
}
else
restmp = create_tmp_reg (restype, "retval");
--- gcc/testsuite/gcc.dg/bitint-70.c.jj 2024-01-16 11:01:48.300524130 +0100
+++ gcc/testsuite/gcc.dg/bitint-70.c 2024-01-16 11:01:19.456924333 +0100
@@ -0,0 +1,14 @@
+/* PR middle-end/113406 */
+/* { dg-do compile { target bitint } } */
+/* { dg-options "-std=c23 -fstrub=internal" } */
+/* { dg-require-effective-target strub } */
+
+#if __BITINT_MAXWIDTH__ >= 146
+_BitInt(146)
+#else
+_BitInt(16)
+#endif
+foo (void)
+{
+ return 0;
+}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ipa-strub: Fix handling of _BitInt returns [PR113406]
2024-01-17 9:44 [PATCH] ipa-strub: Fix handling of _BitInt returns [PR113406] Jakub Jelinek
@ 2024-01-17 12:09 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2024-01-17 12:09 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Alexandre Oliva, gcc-patches
On Wed, 17 Jan 2024, Jakub Jelinek wrote:
> Hi!
>
> Seems pass_ipa_strub::execute contains a copy of the expand_thunk
> code I've changed for _BitInt in r14-6805 PR112941 - larger _BitInts
> are aggregate_value_p even when they are is_gimple_reg_type.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
> ok for trunk?
OK.
> 2024-01-17 Jakub Jelinek <jakub@redhat.com>
>
> PR middle-end/113406
> * ipa-strub.cc (pass_ipa_strub::execute): Check aggregate_value_p
> regardless of whether is_gimple_reg_type (restype) or not.
>
> * gcc.dg/bitint-70.c: New test.
>
> --- gcc/ipa-strub.cc.jj 2024-01-03 11:51:28.374775006 +0100
> +++ gcc/ipa-strub.cc 2024-01-16 10:51:03.987463928 +0100
> @@ -3174,21 +3174,16 @@ pass_ipa_strub::execute (function *)
> resdecl,
> build_int_cst (TREE_TYPE (resdecl), 0));
> }
> - else if (!is_gimple_reg_type (restype))
> + else if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl)))
> {
> - if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl)))
> - {
> - restmp = resdecl;
> + restmp = resdecl;
>
> - if (VAR_P (restmp))
> - {
> - add_local_decl (cfun, restmp);
> - BLOCK_VARS (DECL_INITIAL (current_function_decl))
> - = restmp;
> - }
> + if (VAR_P (restmp))
> + {
> + add_local_decl (cfun, restmp);
> + BLOCK_VARS (DECL_INITIAL (current_function_decl))
> + = restmp;
> }
> - else
> - restmp = create_tmp_var (restype, "retval");
> }
> else
> restmp = create_tmp_reg (restype, "retval");
> --- gcc/testsuite/gcc.dg/bitint-70.c.jj 2024-01-16 11:01:48.300524130 +0100
> +++ gcc/testsuite/gcc.dg/bitint-70.c 2024-01-16 11:01:19.456924333 +0100
> @@ -0,0 +1,14 @@
> +/* PR middle-end/113406 */
> +/* { dg-do compile { target bitint } } */
> +/* { dg-options "-std=c23 -fstrub=internal" } */
> +/* { dg-require-effective-target strub } */
> +
> +#if __BITINT_MAXWIDTH__ >= 146
> +_BitInt(146)
> +#else
> +_BitInt(16)
> +#endif
> +foo (void)
> +{
> + return 0;
> +}
>
> Jakub
>
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-17 12:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-17 9:44 [PATCH] ipa-strub: Fix handling of _BitInt returns [PR113406] Jakub Jelinek
2024-01-17 12:09 ` 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).