public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/13954] New: [tree-ssa] SRA does not work for classes that use inheritance
@ 2004-01-31 21:15 dann at godzilla dot ics dot uci dot edu
  2004-01-31 21:23 ` [Bug optimization/13954] " pinskia at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2004-01-31 21:15 UTC (permalink / raw)
  To: gcc-bugs

SRA does not work for classes that use inheritance.
This is a known issue, filed so that it can be tracked. 

/* { dg-do compile } */ 
/* { dg-options "-O1 -fdump-tree-optimized" } */

void link_error (void);

class base
{
};

class teststruct: public base
{
public:
  double d;
  char f1;
};

void
copystruct1 (teststruct param)
{
  teststruct local;
  param.f1 = 0;
  local = param;
  if (local.f1 != 0)
    link_error ();
}

/* There should be no reference to link_error. */
/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */

-- 
           Summary: [tree-ssa] SRA does not work for classes that use
                    inheritance
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dann at godzilla dot ics dot uci dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug optimization/13954] [tree-ssa] SRA does not work for classes that use inheritance
  2004-01-31 21:15 [Bug optimization/13954] New: [tree-ssa] SRA does not work for classes that use inheritance dann at godzilla dot ics dot uci dot edu
@ 2004-01-31 21:23 ` pinskia at gcc dot gnu dot org
  2004-02-01  0:04 ` dann at godzilla dot ics dot uci dot edu
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-31 21:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-31 21:23 -------
Confirmed, the problem here is more complicated:
Cannot scalarize variable param because it must live in memory
Cannot scalarize variable local because it must live in memory
Cannot scalarize variable MT.3 because it must live in memory

The problem here is that:
void copystruct1(teststruct) (param)
{
  struct 
  {
    double d;
    char f1;
  } * local.0;
  struct 
  {
    double d;
    char f1;
  } * param.1;
  char T.2;

  {
    struct teststruct local;

    param.f1 = 0;
    local.0 = (struct 
    {
      double d;
      char f1;
    } *)&local;
    param.1 = (struct 
    {
      double d;
      char f1;
    } *)&param;
    *local.0 = *param.1;
    {
      T.2 = local.f1;
      if (T.2 != 0)
        {
          {
            link_error ();
          }
        }
      else
        {
          
        }
    }
  }
}

Which means it does not using the right structs assigning or something werid is going on.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |pessimizes-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-01-31 21:23:56
               date|                            |
   Target Milestone|---                         |tree-ssa


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


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

* [Bug optimization/13954] [tree-ssa] SRA does not work for classes that use inheritance
  2004-01-31 21:15 [Bug optimization/13954] New: [tree-ssa] SRA does not work for classes that use inheritance dann at godzilla dot ics dot uci dot edu
  2004-01-31 21:23 ` [Bug optimization/13954] " pinskia at gcc dot gnu dot org
@ 2004-02-01  0:04 ` dann at godzilla dot ics dot uci dot edu
  2004-02-01  7:39 ` dnovillo at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2004-02-01  0:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dann at godzilla dot ics dot uci dot edu  2004-02-01 00:04 -------
This:
> Cannot scalarize variable param because it must live in memory

happens because for "param"  is_gimple_non_addressable returns true 
because "param" has the TREE_ADDRESSABLE bit set. 


-- 


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


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

* [Bug optimization/13954] [tree-ssa] SRA does not work for classes that use inheritance
  2004-01-31 21:15 [Bug optimization/13954] New: [tree-ssa] SRA does not work for classes that use inheritance dann at godzilla dot ics dot uci dot edu
  2004-01-31 21:23 ` [Bug optimization/13954] " pinskia at gcc dot gnu dot org
  2004-02-01  0:04 ` dann at godzilla dot ics dot uci dot edu
@ 2004-02-01  7:39 ` dnovillo at gcc dot gnu dot org
  2004-02-03  3:25 ` rth at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2004-02-01  7:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dnovillo at gcc dot gnu dot org  2004-02-01 07:39 -------

Mine.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |dnovillo at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug optimization/13954] [tree-ssa] SRA does not work for classes that use inheritance
  2004-01-31 21:15 [Bug optimization/13954] New: [tree-ssa] SRA does not work for classes that use inheritance dann at godzilla dot ics dot uci dot edu
                   ` (2 preceding siblings ...)
  2004-02-01  7:39 ` dnovillo at gcc dot gnu dot org
@ 2004-02-03  3:25 ` rth at gcc dot gnu dot org
  2004-02-23 16:29 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-02-03  3:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2004-02-03 03:25 -------
Happens because the C++ front end is amazingly stupid about how it
emits access to members that are not located in virtual bases.

Fixing this requires rearranging how offsetof is handled.

-- 


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


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

* [Bug optimization/13954] [tree-ssa] SRA does not work for classes that use inheritance
  2004-01-31 21:15 [Bug optimization/13954] New: [tree-ssa] SRA does not work for classes that use inheritance dann at godzilla dot ics dot uci dot edu
                   ` (3 preceding siblings ...)
  2004-02-03  3:25 ` rth at gcc dot gnu dot org
@ 2004-02-23 16:29 ` pinskia at gcc dot gnu dot org
  2004-05-15 16:25 ` [Bug c++/13954] " pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-23 16:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-23 16:29 -------
Mine as I am fixing offsetof and some of the C++ front-end also.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|dnovillo at gcc dot gnu dot |pinskia at gcc dot gnu dot
                   |org                         |org


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


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

* [Bug c++/13954] [tree-ssa] SRA does not work for classes that use inheritance
  2004-01-31 21:15 [Bug optimization/13954] New: [tree-ssa] SRA does not work for classes that use inheritance dann at godzilla dot ics dot uci dot edu
                   ` (4 preceding siblings ...)
  2004-02-23 16:29 ` pinskia at gcc dot gnu dot org
@ 2004-05-15 16:25 ` pinskia at gcc dot gnu dot org
  2004-05-24 14:52 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-15 16:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-14 21:55 -------
This is a C++ front-end issue.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |c++


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


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

* [Bug c++/13954] [tree-ssa] SRA does not work for classes that use inheritance
  2004-01-31 21:15 [Bug optimization/13954] New: [tree-ssa] SRA does not work for classes that use inheritance dann at godzilla dot ics dot uci dot edu
                   ` (5 preceding siblings ...)
  2004-05-15 16:25 ` [Bug c++/13954] " pinskia at gcc dot gnu dot org
@ 2004-05-24 14:52 ` pinskia at gcc dot gnu dot org
  2004-06-29 21:27 ` rth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-24 14:52 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.5.0                       |---


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


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

* [Bug c++/13954] [tree-ssa] SRA does not work for classes that use inheritance
  2004-01-31 21:15 [Bug optimization/13954] New: [tree-ssa] SRA does not work for classes that use inheritance dann at godzilla dot ics dot uci dot edu
                   ` (6 preceding siblings ...)
  2004-05-24 14:52 ` pinskia at gcc dot gnu dot org
@ 2004-06-29 21:27 ` rth at gcc dot gnu dot org
  2004-06-29 21:49 ` rth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-06-29 21:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2004-06-29 21:27 -------
Testing a patch.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pinskia at gcc dot gnu dot  |rth at gcc dot gnu dot org
                   |org                         |


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


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

* [Bug c++/13954] [tree-ssa] SRA does not work for classes that use inheritance
  2004-01-31 21:15 [Bug optimization/13954] New: [tree-ssa] SRA does not work for classes that use inheritance dann at godzilla dot ics dot uci dot edu
                   ` (7 preceding siblings ...)
  2004-06-29 21:27 ` rth at gcc dot gnu dot org
@ 2004-06-29 21:49 ` rth at gcc dot gnu dot org
  2004-06-29 22:02 ` rth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-06-29 21:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2004-06-29 21:38 -------
Well, no I'm not.  This is a different problem than I thought.

This is the case of the C++ front end wanting to perform a block copy between
two structures, but *without* copying the trailing padding of the structure.
It decides that the best way to do this is to cast the two structures to an
internal type that doesn't include the padding.

Presumably this is to handle cases in which someone else inherits from 
"teststruct", and reuses the tail padding.  As inheritence is allowed to do.

I almost think that just using __builtin_memcpy would be a better representation,
but that wouldn't have any effect on the scalarizability of this test case.

At least yet.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu dot org
         AssignedTo|rth at gcc dot gnu dot org  |unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug c++/13954] [tree-ssa] SRA does not work for classes that use inheritance
  2004-01-31 21:15 [Bug optimization/13954] New: [tree-ssa] SRA does not work for classes that use inheritance dann at godzilla dot ics dot uci dot edu
                   ` (8 preceding siblings ...)
  2004-06-29 21:49 ` rth at gcc dot gnu dot org
@ 2004-06-29 22:02 ` rth at gcc dot gnu dot org
  2004-06-30  3:06 ` giovannibajo at libero dot it
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-06-29 22:02 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rth at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/13954] [tree-ssa] SRA does not work for classes that use inheritance
  2004-01-31 21:15 [Bug optimization/13954] New: [tree-ssa] SRA does not work for classes that use inheritance dann at godzilla dot ics dot uci dot edu
                   ` (9 preceding siblings ...)
  2004-06-29 22:02 ` rth at gcc dot gnu dot org
@ 2004-06-30  3:06 ` giovannibajo at libero dot it
  2004-06-30 20:13 ` rth at gcc dot gnu dot org
  2004-12-16  7:32 ` rth at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: giovannibajo at libero dot it @ 2004-06-30  3:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-06-30 02:55 -------
Exactly. teststruct is a non-POD (because it derives from base), so you can't 
touch its padding because it could contain data.

-- 


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


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

* [Bug c++/13954] [tree-ssa] SRA does not work for classes that use inheritance
  2004-01-31 21:15 [Bug optimization/13954] New: [tree-ssa] SRA does not work for classes that use inheritance dann at godzilla dot ics dot uci dot edu
                   ` (10 preceding siblings ...)
  2004-06-30  3:06 ` giovannibajo at libero dot it
@ 2004-06-30 20:13 ` rth at gcc dot gnu dot org
  2004-12-16  7:32 ` rth at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-06-30 20:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2004-06-30 20:07 -------
For the record, the cast-vs-memcpy thing has been fixed.
http://gcc.gnu.org/ml/gcc-patches/2004-06/msg02647.html

-- 


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


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

* [Bug c++/13954] [tree-ssa] SRA does not work for classes that use inheritance
  2004-01-31 21:15 [Bug optimization/13954] New: [tree-ssa] SRA does not work for classes that use inheritance dann at godzilla dot ics dot uci dot edu
                   ` (11 preceding siblings ...)
  2004-06-30 20:13 ` rth at gcc dot gnu dot org
@ 2004-12-16  7:32 ` rth at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-12-16  7:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2004-12-16 07:32 -------
Not working on it.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|rth at gcc dot gnu dot org  |unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW


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


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

end of thread, other threads:[~2004-12-16  7:32 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-31 21:15 [Bug optimization/13954] New: [tree-ssa] SRA does not work for classes that use inheritance dann at godzilla dot ics dot uci dot edu
2004-01-31 21:23 ` [Bug optimization/13954] " pinskia at gcc dot gnu dot org
2004-02-01  0:04 ` dann at godzilla dot ics dot uci dot edu
2004-02-01  7:39 ` dnovillo at gcc dot gnu dot org
2004-02-03  3:25 ` rth at gcc dot gnu dot org
2004-02-23 16:29 ` pinskia at gcc dot gnu dot org
2004-05-15 16:25 ` [Bug c++/13954] " pinskia at gcc dot gnu dot org
2004-05-24 14:52 ` pinskia at gcc dot gnu dot org
2004-06-29 21:27 ` rth at gcc dot gnu dot org
2004-06-29 21:49 ` rth at gcc dot gnu dot org
2004-06-29 22:02 ` rth at gcc dot gnu dot org
2004-06-30  3:06 ` giovannibajo at libero dot it
2004-06-30 20:13 ` rth at gcc dot gnu dot org
2004-12-16  7:32 ` rth 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).