public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] ifcvt: Lower bitfields only if suitable for scalar register [PR tree/109005]
@ 2023-03-13 15:53 Andre Vieira (lists)
  2023-03-13 17:47 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Andre Vieira (lists) @ 2023-03-13 15:53 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Biener

[-- Attachment #1: Type: text/plain, Size: 601 bytes --]

This patch fixes the condition check for eligilibity of lowering bitfields,
where before we would check for non-BLKmode types, in the hope of excluding
unsuitable aggregate types, we now check directly the representative is 
not an
aggregate type, i.e. suitable for a scalar register.

I tried adding the reduced testcase mentioned in the PR, but I couldn't 
get the Ada testsuite to run, so could an Ada maintainer add the test 
after verifying it runs properly?

OK for trunk?

gcc/ChangeLog:

	PR tree/109005
	* tree-if-conv.cc (get_bitfield_rep): Replace BLKmode check with
	aggregate type check.

[-- Attachment #2: pr109005.patch --]
[-- Type: text/plain, Size: 807 bytes --]

diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc
index f133102ad3350a0fd3a09ad836c68e840f316a0e..ca1abd8656c6c47c314d2b2c9fa515e150d1703b 100644
--- a/gcc/tree-if-conv.cc
+++ b/gcc/tree-if-conv.cc
@@ -3317,9 +3317,9 @@ get_bitfield_rep (gassign *stmt, bool write, tree *bitpos,
   tree field_decl = TREE_OPERAND (comp_ref, 1);
   tree rep_decl = DECL_BIT_FIELD_REPRESENTATIVE (field_decl);
 
-  /* Bail out if the representative is BLKmode as we will not be able to
-     vectorize this.  */
-  if (TYPE_MODE (TREE_TYPE (rep_decl)) == E_BLKmode)
+  /* Bail out if the representative is not a suitable type for a scalar
+     register variable.  */
+  if (!is_gimple_reg_type (TREE_TYPE (rep_decl)))
     return NULL_TREE;
 
   /* Bail out if the DECL_SIZE of the field_decl isn't the same as the BF's

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

* Re: [PATCH] ifcvt: Lower bitfields only if suitable for scalar register [PR tree/109005]
  2023-03-13 15:53 [PATCH] ifcvt: Lower bitfields only if suitable for scalar register [PR tree/109005] Andre Vieira (lists)
@ 2023-03-13 17:47 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2023-03-13 17:47 UTC (permalink / raw)
  To: Andre Vieira (lists) via Gcc-patches



> Am 13.03.2023 um 16:54 schrieb Andre Vieira (lists) via Gcc-patches <gcc-patches@gcc.gnu.org>:
> 
> This patch fixes the condition check for eligilibity of lowering bitfields,
> where before we would check for non-BLKmode types, in the hope of excluding
> unsuitable aggregate types, we now check directly the representative is not an
> aggregate type, i.e. suitable for a scalar register.
> 
> I tried adding the reduced testcase mentioned in the PR, but I couldn't get the Ada testsuite to run, so could an Ada maintainer add the test after verifying it runs properly?
> 
> OK for trunk?

Ok

Richard 

> gcc/ChangeLog:
> 
>    PR tree/109005
>    * tree-if-conv.cc (get_bitfield_rep): Replace BLKmode check with
>    aggregate type check.
> <pr109005.patch>

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

end of thread, other threads:[~2023-03-13 17:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-13 15:53 [PATCH] ifcvt: Lower bitfields only if suitable for scalar register [PR tree/109005] Andre Vieira (lists)
2023-03-13 17:47 ` 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).