public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joe Buck <jbuck@synopsys.com>
To: rth@cygnus.com
Cc: egcs@cygnus.com
Subject: Re: switch index optimization
Date: Sun, 25 Jan 1998 23:02:00 -0000	[thread overview]
Message-ID: <199801260701.XAA10048@atrus.synopsys.com> (raw)
In-Reply-To: <19980125223511.42443@dot.cygnus.com>

> The talk on linux-kernel about the bogus non-void function returns
> without a value warning you get from
> 
>   int foo(int x, int y) {
>     switch (x & 3) { 
>       case 0: ...; return y;
>       case 1: ...; return y;
>       case 2: ...; return y;
>       case 3: ...; return y;
>     }
>   }
> 
> got me thinking.  The following patch won't actually fix this case,
> since this is below the threshold for a tablejump, but it points the
> way, and does do some good.  

[ patch deleted ]

Not a bad idea, but kind of an unclean implementation.

If you're going to start putting in recognizers for expressions that
have restricted ranges, I think it would be better to put them
in a separate function, and write it in a clean way so you can cover
more cases.  The function would return the range (or an over-approximation
of the range) of the expression.  You could then cleanly handle bitwise
and, modulo, branching on a char, etc.  

But to do really well, range propagation needs to be done with dataflow
analysis (though in this case you can do it without).

  reply	other threads:[~1998-01-25 23:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-01-25 22:34 Richard Henderson
1998-01-25 23:02 ` Joe Buck [this message]
1998-01-25 23:14   ` Richard Henderson
1998-01-25 23:27     ` Jeffrey A Law
1998-01-27  7:35       ` Lassi A. Tuura
1998-01-27  9:36         ` Jeffrey A Law
1998-01-27 13:09         ` Andi Kleen
1998-01-27  9:59           ` Jeffrey A Law
1998-01-27 10:20             ` Joe Buck
1998-01-27 13:09               ` Jeffrey A Law
     [not found] <egcs.199801271819.KAA01586@atrus.synopsys.com>
1998-01-28  1:10 ` Todd P. Whitesel

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=199801260701.XAA10048@atrus.synopsys.com \
    --to=jbuck@synopsys.com \
    --cc=egcs@cygnus.com \
    --cc=rth@cygnus.com \
    /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).