public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jsjodin at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/34043] Missed optimization causing extra loads and stores when using x86_64 builtin function together with aggregate types.
Date: Tue, 13 Nov 2007 17:07:00 -0000	[thread overview]
Message-ID: <20071113170716.7151.qmail@sourceware.org> (raw)
In-Reply-To: <bug-34043-14442@http.gcc.gnu.org/bugzilla/>



------- Comment #5 from jsjodin at gcc dot gnu dot org  2007-11-13 17:07 -------
(In reply to comment #4)
> Related to PR 33790 (and most likely fixed by it).  There is another issue with
> that bug relating to not deleting the extra store.
> 

Indeed the extra load disappeared when with the patch. The store did not get
deleted as expected. I looked at the differences between the good and bad case. 
Compiling the good case has the following sequence before the fre pass:
Note: src and dst are unions

src.f = D.9650_45;
D.9630_31 = src.f;
D.9655_46 = __builtin_ia32_addps (D.9630_31, D.9630_31);
dst.f = D.9655_46;
D.9632_33 = dst.f;                

After fre the temps have been propagated and replaced the uses of dst.f:

src.f = D.9650_45;                                                              
D.9630_31 = D.9650_45;                                                          
D.9655_46 = __builtin_ia32_addps (D.9630_31, D.9630_31);                        
dst.f = D.9655_46;                                                              
D.9632_33 = D.9655_46;

The extra stores to src.f are eliminated in dce. 

The bad case has the following code before and after fre:
src.i = D.9651_44;                                                              
D.9630_31 = src.f;                                                              
D.9655_45 = __builtin_ia32_addps (D.9630_31, D.9630_31);                        
dst.f = D.9655_45;                                                              
D.9632_33 = dst.i;   

Since the src.i and src.f are probably not considered to be the same the
propagation does not work. It might be possible to handle this case if one
consideres the size of data being written and read from unions.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34043


  parent reply	other threads:[~2007-11-13 17:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-09 16:14 [Bug tree-optimization/34043] New: " jsjodin at gcc dot gnu dot org
2007-11-09 16:16 ` [Bug tree-optimization/34043] " jsjodin at gcc dot gnu dot org
2007-11-09 16:16 ` jsjodin at gcc dot gnu dot org
2007-11-09 16:17 ` jsjodin at gcc dot gnu dot org
2007-11-09 18:24 ` pinskia at gcc dot gnu dot org
2007-11-13 17:07 ` jsjodin at gcc dot gnu dot org [this message]
2007-12-03 15:42 ` jsjodin at gcc dot gnu dot org
2007-12-09 22:34 ` pinskia at gcc dot gnu dot org
2007-12-13  1:57 ` jsjodin at gcc dot gnu dot org
2008-01-03 17:45 ` rguenth at gcc dot gnu dot org
2008-01-04 15:54 ` rguenth at gcc dot gnu dot org
2008-01-04 15:58 ` rguenth at gcc dot gnu dot org
2008-02-28 16:41 ` rguenth at gcc dot gnu dot org
2008-03-14 14:53 ` rguenth at gcc dot gnu dot org
2008-03-14 16:17 ` rguenth at gcc dot gnu dot 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=20071113170716.7151.qmail@sourceware.org \
    --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).