public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/28075]  New: gimplifier introduces unnecessary type conversions
@ 2006-06-17 19:44 rguenth at gcc dot gnu dot org
  2006-06-17 19:45 ` [Bug middle-end/28075] " rguenth at gcc dot gnu dot org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-06-17 19:44 UTC (permalink / raw)
  To: gcc-bugs

typedef struct {
  double min;
  double max;
} interval;
inline interval add(interval x, interval y)
{
  interval r;
  r.min = x.min + y.min;
  r.max = x.max + y.max;
  return r;
}
interval foo (interval a, interval b, interval c)
{
  return add (a, add (b, c));
}

for the temporary for gimplifying the nested call to add, the gimplifier
introduces a temporary of type TYPE_MAIN_VARIANT (interval), which survives
as added casts.

This happens here:

static inline tree
create_tmp_from_val (tree val)
{
  return create_tmp_var (TYPE_MAIN_VARIANT (TREE_TYPE (val)), get_name (val));
}

in the optimized dump we still have

foo (a, b, c)
{
  double r$min;
  double r$min;
  double a$max;
  double a$min;
  struct interval y;
  struct
  {
    double min;
    double max;
  } D.1542;

<bb 2>:
  a$max = a.max;
  a$min = a.min;
  r$min = b.min + c.min;
  D.1542.max = b.max + c.max;
  D.1542.min = r$min;
  y = (struct interval) D.1542;
  r$min = y.min + a$min;
  <retval>.max = y.max + a$max;
  <retval>.min = r$min;
  return <retval>;

}

by simply removing this TYPE_MAIN_VARAINT there we end up with two
temporary structures less:

Analyzing Edge Insertions.
foo (a, b, c)
{
  double r$min;

<bb 2>:
  r$min = b.min + c.min + a.min;
  <retval>.max = b.max + c.max + a.max;
  <retval>.min = r$min;
  return <retval>;

}


-- 
           Summary: gimplifier introduces unnecessary type conversions
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, memory-hog, compile-time-hog
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2006-08-26 14:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-17 19:44 [Bug middle-end/28075] New: gimplifier introduces unnecessary type conversions rguenth at gcc dot gnu dot org
2006-06-17 19:45 ` [Bug middle-end/28075] " rguenth at gcc dot gnu dot org
2006-06-17 19:51 ` pinskia at gcc dot gnu dot org
2006-06-17 19:53 ` rguenth at gcc dot gnu dot org
2006-06-17 19:55 ` [Bug middle-end/28075] inliner " pinskia at gcc dot gnu dot org
2006-06-17 21:04 ` [Bug middle-end/28075] [4.1/4.2 Regression] " rguenth at gcc dot gnu dot org
2006-06-20  2:11 ` pinskia at gcc dot gnu dot org
2006-06-20  3:43 ` [Bug middle-end/28075] [4.1 " pinskia at gcc dot gnu dot org
2006-06-26 13:47 ` danglin at gcc dot gnu dot org
2006-06-26 14:35 ` dave at hiauly1 dot hia dot nrc dot ca
2006-06-26 16:41 ` pinskia at gmail dot com
2006-06-29 21:37 ` patchapp at dberlin dot org
2006-06-30 14:40 ` pinskia at gcc dot gnu dot org
2006-07-22 12:42 ` hubicka at gcc dot gnu dot org
2006-07-22 18:54 ` rguenth at gcc dot gnu dot org
2006-08-14 14:13 ` pinskia at gcc dot gnu dot org
2006-08-14 14:15 ` pinskia at gcc dot gnu dot org
2006-08-26 14:00 ` ebotcazou at gcc dot gnu dot org

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).