public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hariharan.gcc at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/22141] [4.8/4.9/5 Regression] Missing optimization when storing structures
Date: Mon, 02 Feb 2015 19:30:00 -0000	[thread overview]
Message-ID: <bug-22141-4-cTg4pfGqYD@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-22141-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=22141

hariharan.gcc at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hariharan.gcc at gmail dot com

--- Comment #30 from hariharan.gcc at gmail dot com ---
I saw a related problem, this time with bitfields

$more bitfieldtest.c

typedef union {
  struct {
    unsigned int b1:1;
    unsigned int b2:1;
    unsigned int b3:1;
    unsigned int b4:1;
    unsigned int b5:1;
  }fields;
  unsigned int word;
} _t_bitfields;


void _const_populate_bits(_t_bitfields * data)
{
  data->fields.b1 = 1;
  data->fields.b2 = 0;
  data->fields.b3 = 1;
  data->fields.b4 = 1;
  data->fields.b5 = 0;
}

At the end of tree stages, it looks like this

$more bitfieldtest.c.165t.optimized

;; Function _const_populate_bits (_const_populate_bits, funcdef_no=0,
decl_uid=1339, cgraph_uid=0)

_const_populate_bits (union _t_bitfields * data)
{
  <bb 2>:
  data_2(D)->fields.b1 = 1;
  data_2(D)->fields.b2 = 0;
  data_2(D)->fields.b3 = 1;
  data_2(D)->fields.b4 = 1;
  data_2(D)->fields.b5 = 0;
  return;

}

Expand expands each one of the assignments in turn and some get combined later
on into ok-ish code. It would be nice to be able to combine all 5 assignments
into one.

Its kind of related to this PR, but is it sufficiently different to warrant a
separate PR for it?


  parent reply	other threads:[~2015-02-02 19:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-22141-4@http.gcc.gnu.org/bugzilla/>
2011-06-27 15:02 ` [Bug middle-end/22141] [4.3/4.4/4.5/4.6/4.7 " rguenth at gcc dot gnu.org
2012-01-12 11:20 ` [Bug middle-end/22141] [4.4/4.5/4.6/4.7 " rguenth at gcc dot gnu.org
2012-03-13 15:32 ` [Bug middle-end/22141] [4.5/4.6/4.7/4.8 " jakub at gcc dot gnu.org
2012-05-19 23:52 ` pinskia at gcc dot gnu.org
2012-07-02 12:02 ` rguenth at gcc dot gnu.org
2013-04-12 15:18 ` [Bug middle-end/22141] [4.7/4.8/4.9 " jakub at gcc dot gnu.org
2014-06-12 13:49 ` [Bug middle-end/22141] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
2014-12-19 13:33 ` [Bug middle-end/22141] [4.8/4.9/5 " jakub at gcc dot gnu.org
2015-02-02 19:30 ` hariharan.gcc at gmail dot com [this message]
2015-06-23  8:27 ` [Bug middle-end/22141] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
2015-06-26 20:01 ` [Bug middle-end/22141] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:32 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-22141-4-cTg4pfGqYD@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).