public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/23335] New: out of ssa does not delete single def single use variable
@ 2005-08-11 17:54 dann at godzilla dot ics dot uci dot edu
  2005-08-11 17:55 ` [Bug tree-optimization/23335] " dann at godzilla dot ics dot uci dot edu
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2005-08-11 17:54 UTC (permalink / raw)
  To: gcc-bugs

The .t82.uncprop dump looks like this:

<L16>:;
  D.15800_45 = *params_11;
  __nptr_47 = D.15800_45;
  D.15802_50 = __strtol_internal (__nptr_47, 0B, 10, 0);
  mult_55 = mult_1 * D.15802_50;
  goto <bb 15> (<L8>);

<L17>:;
  D.15800_29 = *params_11;
  __nptr_31 = D.15800_29;
  D.15807_34 = __strtol_internal (__nptr_31, 0B, 10, 0);
  D.15790_39 = screen_16->whichVwin;
  D.15791_40 = D.15790_39->f_height;
  mult_41 = D.15807_34 * D.15791_40;
  goto <bb 15> (<L8>);

<L18>:;
  D.15811_25 = screen_16->scrolllines;
  D.15790_26 = screen_16->whichVwin;
  D.15791_27 = D.15790_26->f_height;
  mult_28 = D.15811_25 * D.15791_27;
  goto <bb 15> (<L8>);

<L6>:;
  D.15698_10 = gw_4->core.parent;
  D.15697_13 = AmountToScroll (D.15698_10, params_11, nparams_12);

  # D.15697_3 = PHI <0(3), mult_41(12), D.15697_13(14), 0(0), mult_55(11),
mult_28(13)>;
<L8>:;
  return D.15697_3;


and the .t87.final_cleanup dump looks like:

<L16>:;
  D.15802 = __strtol_internal (*params, 0B, 10, 0);
  mult.78 = mult * D.15802;
  D.15697 = mult.78;
  goto <bb 17> (<L26>);

<L17>:;
  D.15807 = __strtol_internal (*params, 0B, 10, 0);
  mult.77 = D.15807 * screen->whichVwin->f_height;
  D.15697 = mult.77;
  goto <bb 17> (<L26>);

<L18>:;
  mult.76 = screen->scrolllines * screen->whichVwin->f_height;
  D.15697 = mult.76;
  goto <bb 17> (<L26>);

<L6>:;
  D.15697 = AmountToScroll (gw->core.parent, params, nparams);
  goto <bb 17> (<L26>);

<L8>:;
  D.15697 = 0;

<L26>:;
  return D.15697;

Note that the mult.76, mult.77, mult.78 have a single use and a single def, they
could be eliminated.

Preprocessed code will be attached. The compilation flags were -O2 -march=i686
The function to look at is AmmountToScroll

-- 
           Summary: out of ssa does not delete single def single use
                    variable
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-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
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug tree-optimization/23335] out of ssa does not delete single def single use variable
  2005-08-11 17:54 [Bug tree-optimization/23335] New: out of ssa does not delete single def single use variable dann at godzilla dot ics dot uci dot edu
@ 2005-08-11 17:55 ` dann at godzilla dot ics dot uci dot edu
  2005-08-11 17:56 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2005-08-11 17:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dann at godzilla dot ics dot uci dot edu  2005-08-11 17:55 -------
Created an attachment (id=9475)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9475&action=view)
Preprocessed code that shows the problem


-- 


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


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

* [Bug tree-optimization/23335] out of ssa does not delete single def single use variable
  2005-08-11 17:54 [Bug tree-optimization/23335] New: out of ssa does not delete single def single use variable dann at godzilla dot ics dot uci dot edu
  2005-08-11 17:55 ` [Bug tree-optimization/23335] " dann at godzilla dot ics dot uci dot edu
@ 2005-08-11 17:56 ` pinskia at gcc dot gnu dot org
  2005-08-11 18:23 ` [Bug tree-optimization/23335] out of ssa does coalesce some variables pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-11 17:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-11 17:56 -------
TER should have done that ...

-- 


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


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

* [Bug tree-optimization/23335] out of ssa does coalesce some variables
  2005-08-11 17:54 [Bug tree-optimization/23335] New: out of ssa does not delete single def single use variable dann at godzilla dot ics dot uci dot edu
  2005-08-11 17:55 ` [Bug tree-optimization/23335] " dann at godzilla dot ics dot uci dot edu
  2005-08-11 17:56 ` pinskia at gcc dot gnu dot org
@ 2005-08-11 18:23 ` pinskia at gcc dot gnu dot org
  2005-08-11 18:33 ` [Bug tree-optimization/23335] copyrename does not coalesce same type varibles (useless type conversion) pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-11 18:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-11 18:23 -------
What is happening is that out of SSA is doing almost no coalescing at all, it only coalesces SSA_NAME 
which have the same decl.

To me, it looks like copyrename is missing an opportunity to rename a SSANAME:
  # D.15690_3 = PHI <0(3), mult_41(12), D.15690_13(14), 0(0), mult_55(11), mult_28(13)>;


well it turns out this might be harder to do than orginally I had thought as one of the arguments to the 
PHI is does not have a SSA_NAME whos decl is mult.

This problem is understood but hard to get right.

I will try to get a small example for this issue, note this is also an issue in 4.0.0 too.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
            Summary|out of ssa does not delete  |out of ssa does coalesce
                   |single def single use       |some variables
                   |variable                    |


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


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

* [Bug tree-optimization/23335] copyrename does not coalesce same type varibles (useless type conversion)
  2005-08-11 17:54 [Bug tree-optimization/23335] New: out of ssa does not delete single def single use variable dann at godzilla dot ics dot uci dot edu
                   ` (2 preceding siblings ...)
  2005-08-11 18:23 ` [Bug tree-optimization/23335] out of ssa does coalesce some variables pinskia at gcc dot gnu dot org
@ 2005-08-11 18:33 ` pinskia at gcc dot gnu dot org
  2005-08-11 18:47 ` [Bug tree-optimization/23335] [4.0/4.1 Regression] copyrename does not coalesce different type variables " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-11 18:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-11 18:33 -------
Oh, if I change long to int, it works fine and if we look at .copyrename we find:
Try : D.15755_20(P20) & mult_2(P2) : Incompatible types.  No coalesce.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|out of ssa does coalesce    |copyrename does not coalesce
                   |some variables              |same type varibles (useless
                   |                            |type conversion)


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


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

* [Bug tree-optimization/23335] [4.0/4.1 Regression] copyrename does not coalesce different type variables (useless type conversion)
  2005-08-11 17:54 [Bug tree-optimization/23335] New: out of ssa does not delete single def single use variable dann at godzilla dot ics dot uci dot edu
                   ` (3 preceding siblings ...)
  2005-08-11 18:33 ` [Bug tree-optimization/23335] copyrename does not coalesce same type varibles (useless type conversion) pinskia at gcc dot gnu dot org
@ 2005-08-11 18:47 ` pinskia at gcc dot gnu dot org
  2005-08-11 18:48 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-11 18:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-11 18:47 -------
Here is a simple example:
int f(void);
long h(int screen)
{
  int mult = 1;
  if (screen)
    return 0;
  mult = f();
  return mult;
}

This is a regression from 3.4.0 were we produced one less set RTL.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization, TREE
   Last reconfirmed|0000-00-00 00:00:00         |2005-08-11 18:47:44
               date|                            |
            Summary|copyrename does not coalesce|[4.0/4.1 Regression]
                   |same type varibles (useless |copyrename does not coalesce
                   |type conversion)            |different type variables
                   |                            |(useless type conversion)
   Target Milestone|---                         |4.0.2


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


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

* [Bug tree-optimization/23335] [4.0/4.1 Regression] copyrename does not coalesce different type variables (useless type conversion)
  2005-08-11 17:54 [Bug tree-optimization/23335] New: out of ssa does not delete single def single use variable dann at godzilla dot ics dot uci dot edu
                   ` (4 preceding siblings ...)
  2005-08-11 18:47 ` [Bug tree-optimization/23335] [4.0/4.1 Regression] copyrename does not coalesce different type variables " pinskia at gcc dot gnu dot org
@ 2005-08-11 18:48 ` pinskia at gcc dot gnu dot org
  2005-08-12 14:48 ` amacleod at redhat dot com
  2005-09-27 16:19 ` mmitchel at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-11 18:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-11 18:48 -------
(In reply to comment #5)
Note the code gen for this testcase is the same for both 3.4 and 4.0, though you could find one where 
we actually produces much worse code gen.

-- 


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


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

* [Bug tree-optimization/23335] [4.0/4.1 Regression] copyrename does not coalesce different type variables (useless type conversion)
  2005-08-11 17:54 [Bug tree-optimization/23335] New: out of ssa does not delete single def single use variable dann at godzilla dot ics dot uci dot edu
                   ` (5 preceding siblings ...)
  2005-08-11 18:48 ` pinskia at gcc dot gnu dot org
@ 2005-08-12 14:48 ` amacleod at redhat dot com
  2005-09-27 16:19 ` mmitchel at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: amacleod at redhat dot com @ 2005-08-12 14:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amacleod at redhat dot com  2005-08-12 14:48 -------
What exactly do you want to do here?

you've got

  int = expr
  long int = int

if you want to get rid of the copy, you would have to turn it into 
  long int = (long int)expr

which is more complicated than simple expression replacement.  

In your example, the opportunity also only exists *after* the PHIs have been
expanded, which means we are no longer in SSA form either, so the copyrename
pass isn't applicable. we'd need a new pass/hacks within out-of-ssa, or a post
pass on non-ssa trees.  Does this actually affect the code generated? I would
think the RTL optimizers should be able to handle it.



-- 


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


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

* [Bug tree-optimization/23335] [4.0/4.1 Regression] copyrename does not coalesce different type variables (useless type conversion)
  2005-08-11 17:54 [Bug tree-optimization/23335] New: out of ssa does not delete single def single use variable dann at godzilla dot ics dot uci dot edu
                   ` (6 preceding siblings ...)
  2005-08-12 14:48 ` amacleod at redhat dot com
@ 2005-09-27 16:19 ` mmitchel at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:19 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


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


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

* [Bug tree-optimization/23335] [4.0/4.1 Regression] copyrename does not coalesce different type variables (useless type conversion)
       [not found] <bug-23335-1008@http.gcc.gnu.org/bugzilla/>
  2005-10-29 22:44 ` steven at gcc dot gnu dot org
@ 2005-10-31  4:55 ` mmitchel at gcc dot gnu dot org
  1 sibling, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-10-31  4:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from mmitchel at gcc dot gnu dot org  2005-10-31 04:55 -------
I'm going to resolve this as INVALID.  If there's a bug here, we need a test
case that shows that inferior code; then, we can reopen this bug.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug tree-optimization/23335] [4.0/4.1 Regression] copyrename does not coalesce different type variables (useless type conversion)
       [not found] <bug-23335-1008@http.gcc.gnu.org/bugzilla/>
@ 2005-10-29 22:44 ` steven at gcc dot gnu dot org
  2005-10-31  4:55 ` mmitchel at gcc dot gnu dot org
  1 sibling, 0 replies; 11+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-10-29 22:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from steven at gcc dot gnu dot org  2005-10-29 22:43 -------
Is the only problem here one single extra SET produced by expand, or do we have
a bug here somewhere?


-- 


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


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

end of thread, other threads:[~2005-10-31  4:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-11 17:54 [Bug tree-optimization/23335] New: out of ssa does not delete single def single use variable dann at godzilla dot ics dot uci dot edu
2005-08-11 17:55 ` [Bug tree-optimization/23335] " dann at godzilla dot ics dot uci dot edu
2005-08-11 17:56 ` pinskia at gcc dot gnu dot org
2005-08-11 18:23 ` [Bug tree-optimization/23335] out of ssa does coalesce some variables pinskia at gcc dot gnu dot org
2005-08-11 18:33 ` [Bug tree-optimization/23335] copyrename does not coalesce same type varibles (useless type conversion) pinskia at gcc dot gnu dot org
2005-08-11 18:47 ` [Bug tree-optimization/23335] [4.0/4.1 Regression] copyrename does not coalesce different type variables " pinskia at gcc dot gnu dot org
2005-08-11 18:48 ` pinskia at gcc dot gnu dot org
2005-08-12 14:48 ` amacleod at redhat dot com
2005-09-27 16:19 ` mmitchel at gcc dot gnu dot org
     [not found] <bug-23335-1008@http.gcc.gnu.org/bugzilla/>
2005-10-29 22:44 ` steven at gcc dot gnu dot org
2005-10-31  4:55 ` mmitchel 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).