public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "steven at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug optimization/14341] Missed comparision optimization (jump threading related)
Date: Sun, 29 Feb 2004 14:20:00 -0000	[thread overview]
Message-ID: <20040229142001.10713.qmail@sources.redhat.com> (raw)
In-Reply-To: <20040229062941.14341.pinskia@gcc.gnu.org>


------- Additional Comments From steven at gcc dot gnu dot org  2004-02-29 14:19 -------
Tree dump after DCE1: 
 
t () 
{ 
  int x; 
  int i; 
  int T.0; 
 
  # BLOCK 0 
  # PRED: ENTRY (fallthru) 
  i_2 = 0; 
  goto <bb 2> (<L1>); 
  # SUCC: 2 (fallthru) 
 
  # BLOCK 1 
  # PRED: 2 (true) 
<L0>:; 
  T.0_3 = i_1 <= 99999999; 
  f (T.0_3); 
  i_4 = i_1 + 1; 
  # SUCC: 2 (fallthru) 
 
  # BLOCK 2 
  # PRED: 1 (fallthru) 0 (fallthru) 
  # i_1 = PHI <i_2(0), i_4(1)>; 
<L1>:; 
  if (i_1 <= 99999999) goto <L0>; else goto <L2>; 
  # SUCC: 3 (false) 1 (true) 
 
  # BLOCK 3 
  # PRED: 2 (false) 
<L2>:; 
  return; 
  # SUCC: EXIT 
 
} 
 
The dominator tree looks like this: 
 
bb0 
| 
bb2 (contains loop exit condition "i < 100000000") 
|\ 
| \ 
|  \ 
|   bb1 (contains "f(i < 100000000);") 
| 
bb3 
 
So the loop exit condition dominates the function call and we should be able 
to optimize that test. 
 
 
 
Tree dump after DOM1: 
 
t () 
{ 
  int x; 
  int i; 
  int T.0; 
 
  # BLOCK 0 
  # PRED: ENTRY (fallthru) 
  i_5 = 0; 
  i_6 = 0; 
  # SUCC: 1 (fallthru) 
 
  # BLOCK 1 
  # PRED: 0 (fallthru) 1 (true) 
  # i_1 = PHI <0(0), i_7(1)>; 
<L0>:; 
  T.0_3 = i_1 <= 99999999; 
  f (T.0_3); 
  i_7 = i_1 + 1; 
  if (i_7 <= 99999999) goto <L0>; else goto <L2>; 
  # SUCC: 2 (false) 1 (true) 
 
  # BLOCK 2 
  # PRED: 1 (false) 
<L2>:; 
  return; 
  # SUCC: EXIT 
 
} 
 
 
The dominator tree looks like this: 
 
bb0 
| 
bb1 (contains loop exit condition "i < 100000000" 
|    and "f(i < 100000000);") 
| 
bb3 
 
So the loop exit condition no longer dominates the function call, and we lose. 
 
So perhaps we are threading jumps too early. 

-- 


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


  parent reply	other threads:[~2004-02-29 14:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-29  6:29 [Bug optimization/14341] New: Missed optimization pinskia at gcc dot gnu dot org
2004-02-29  6:37 ` [Bug optimization/14341] Missed comparision optimization (jump threading related) pinskia at gcc dot gnu dot org
2004-02-29 14:20 ` steven at gcc dot gnu dot org [this message]
2004-02-29 16:15 ` pinskia at gcc dot gnu dot org
2004-03-01  4:28 ` law at redhat dot com
2004-03-01 14:37 ` law at gcc dot gnu dot org
2004-03-07  4:51 ` pinskia at gcc dot gnu dot org
2004-03-07  4:52 ` pinskia at gcc dot gnu dot org
2004-05-13 20:26 ` [Bug tree-optimization/14341] " pinskia at gcc dot gnu dot org
2004-05-24 16:51 ` pinskia at gcc dot gnu dot org
2004-12-22  5:23 ` kazu at cs dot umass dot edu
2004-12-22  5:33 ` pinskia at gcc dot gnu dot org
2004-12-23 18:32 ` law at redhat dot com
2005-01-31 14:03 ` kazu at cs dot umass dot edu
2005-01-31 14:47 ` pinskia at gcc dot gnu dot org
2005-01-31 15:25 ` [Bug tree-optimization/14341] Missed comparison " kazu at cs dot umass dot edu
2005-01-31 15:33 ` pinskia at gcc dot gnu dot org
2005-01-31 15:43 ` kazu at cs dot umass dot edu
2005-05-07 19:30 ` [Bug tree-optimization/14341] Missed comparison optimization (VRP) pinskia at gcc dot gnu dot org
2005-06-02  2:58 ` cvs-commit at gcc dot gnu dot org
2005-06-02  3:03 ` dnovillo at gcc dot gnu dot org
2005-06-02 18:44 ` pinskia at gcc dot gnu dot org
2005-09-10 18:11 ` pinskia 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=20040229142001.10713.qmail@sources.redhat.com \
    --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).