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


------- Additional Comments From law at redhat dot com  2004-03-01 04:28 -------
Subject: Re:  Missed comparision optimization (jump 
 threading related)

In message <20040229142002.10721.qmail@sources.redhat.com>, "steven at gcc dot 
gnu dot org" writes:
 >
 >------- 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. 
But what the tree dumps don't show is that the types of those expressions
are fundamentally different.  So while it may appear that the expressions
are the same, they are, from the compiler's standpoint different.

In the stagement "T.0_3 = i_1 <= 99999999"

The expression i_1 <= 99999999 has a signed integer type as mandated by
the C standard.

In the statement "if (i1 <= 99999999) ..." the expression i1 <= 99999999
has a boolean type.

Those types differ in significant ways.  They differ in signedness, their
underlying modes and width of the datatype.

The compiler has to be extremely careful when creating equivalences for
objects which have types which differ in these ways.  In this specific case,
both types are integers and the range of the expression they generate is 0..1
inclusive, so there may be something we can do.  Then again, this may prove
too intrusive and ugly to try and fix.

In general, the first thing to do anytime you see a seemingly redundant
expression that is not eliminated is to verify that the underlying types
of the expressions are equivalent.

Jeff



-- 


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


  parent reply	other threads:[~2004-03-01  4:28 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
2004-02-29 16:15 ` pinskia at gcc dot gnu dot org
2004-03-01  4:28 ` law at redhat dot com [this message]
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=20040301042821.6793.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).