public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14016] New: [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones
@ 2004-02-04  8:02 dann at godzilla dot ics dot uci dot edu
  2004-02-04  8:08 ` [Bug optimization/14016] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2004-02-04  8:02 UTC (permalink / raw)
  To: gcc-bugs

For:
void test55 (void)
{
  int u;
  int XXX, YYY;
  XXX = foo ();
  YYY = bar ();
  if (XXX != 5 && YYY)
    {
      u = XXX + 22;
      if (u != 27)
        baz ();
    }
}

The .optimized dump looks like:
;; Function test55 (test55)

test55 ()
{
  int T.1;
  int T.0;

<bb 0>:
  T.0 = foo ();
  T.1 = bar ();
  if (T.0 != 5 && T.1 != 0) goto <L0>; else goto <L2>;

<L0>:;
  if (T.0 + 22 != 27) goto <L1>; else goto <L2>;

<L1>:;
  baz ();

<L2>:;
<L3>:;
  return;

}

The XXX and YYY variables have been replaced with the compiler generated T.0 
and T.1

T.0 and T.1 are created in .generic
  T.0 = foo ();
  XXX = T.0;
  T.1 = bar ();
  YYY = T.1;
  T.2 = XXX != 5;
  T.3 = YYY != 0;
  T.4 = T.2 && T.3;

in .dom1 XXX and YYY in the T.2 and T.3 assignments are replaces with T.0 and
T.1

  T.0_1 = foo ();
  XXX_2 = T.0_1;
  T.1_3 = bar ();
  YYY_4 = T.1_3;
  T.2_5 = T.0_1 != 5;
  T.3_6 = T.1_3 != 0;

and finally dce2 eliminates XXX and YYY as they are not used anymore.

-- 
           Summary: [tree-ssa] User variable get eliminated, only to be
                    replaced with compiler generated ones
           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=14016


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

* [Bug optimization/14016] [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones
  2004-02-04  8:02 [Bug optimization/14016] New: [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones dann at godzilla dot ics dot uci dot edu
@ 2004-02-04  8:08 ` pinskia at gcc dot gnu dot org
  2004-02-04 23:43 ` steven at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-04  8:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-04 08:08 -------
Confirmed, I am ready to add a pessimizes-debug keyword also.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |memory-hog
   Last reconfirmed|0000-00-00 00:00:00         |2004-02-04 08:08:30
               date|                            |
   Target Milestone|---                         |tree-ssa


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


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

* [Bug optimization/14016] [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones
  2004-02-04  8:02 [Bug optimization/14016] New: [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones dann at godzilla dot ics dot uci dot edu
  2004-02-04  8:08 ` [Bug optimization/14016] " pinskia at gcc dot gnu dot org
@ 2004-02-04 23:43 ` steven at gcc dot gnu dot org
  2004-02-05  0:29 ` steven at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-02-04 23:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-02-04 23:43 -------
This comment in gimplify_modify_expr seems to be relevant here: 
 
      /* If the RHS of the MODIFY_EXPR may throw or make a nonlocal goto and 
         the LHS is a user variable, then we need to introduce a temporary. 
         ie temp = RHS; LHS = temp. 
 
         This way the optimizers can determine that the user variable is 
         only modified if evaluation of the RHS does not throw. 
 
         FIXME this should be handled by the is_gimple_rhs predicate.  */ 
 

-- 


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


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

* [Bug optimization/14016] [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones
  2004-02-04  8:02 [Bug optimization/14016] New: [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones dann at godzilla dot ics dot uci dot edu
  2004-02-04  8:08 ` [Bug optimization/14016] " pinskia at gcc dot gnu dot org
  2004-02-04 23:43 ` steven at gcc dot gnu dot org
@ 2004-02-05  0:29 ` steven at gcc dot gnu dot org
  2004-02-05  0:30 ` steven at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-02-05  0:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-02-05 00:28 -------
Perhaps something like this patch.  Dan can you test this? 
 
Index: gimplify.c 
=================================================================== 
RCS file: /cvs/gcc/gcc/gcc/Attic/gimplify.c,v 
retrieving revision 1.1.2.141 
diff -c -3 -p -r1.1.2.141 gimplify.c 
*** gimplify.c  30 Jan 2004 13:14:02 -0000      1.1.2.141 
--- gimplify.c  5 Feb 2004 00:26:34 -0000 
*************** gimplify_modify_expr (tree *expr_p, tree 
*** 2389,2396 **** 
 
         FIXME this should be handled by the is_gimple_rhs predicate.  */ 
 
!       if (TREE_CODE (*from_p) == CALL_EXPR 
!         || (flag_non_call_exceptions && tree_could_trap_p (*from_p)) 
          /* If we're dealing with a renamable type, either source or dest 
             must be a renamed variable.  */ 
          || (is_gimple_reg_type (TREE_TYPE (*from_p)) 
--- 2389,2395 ---- 
 
         FIXME this should be handled by the is_gimple_rhs predicate.  */ 
 
!       if (tree_could_throw_p (*from_p) 
          /* If we're dealing with a renamable type, either source or dest 
             must be a renamed variable.  */ 
          || (is_gimple_reg_type (TREE_TYPE (*from_p)) 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at redhat dot com


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


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

* [Bug optimization/14016] [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones
  2004-02-04  8:02 [Bug optimization/14016] New: [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones dann at godzilla dot ics dot uci dot edu
                   ` (2 preceding siblings ...)
  2004-02-05  0:29 ` steven at gcc dot gnu dot org
@ 2004-02-05  0:30 ` steven at gcc dot gnu dot org
  2004-02-05 23:25 ` steven at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-02-05  0:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-02-05 00:30 -------
ay, wait.  this won't work because now it would completely ignore noncall 
exceptions.  But the logic may need to be similar to what tree_could_throw_p 
does... 

-- 


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


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

* [Bug optimization/14016] [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones
  2004-02-04  8:02 [Bug optimization/14016] New: [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones dann at godzilla dot ics dot uci dot edu
                   ` (3 preceding siblings ...)
  2004-02-05  0:30 ` steven at gcc dot gnu dot org
@ 2004-02-05 23:25 ` steven at gcc dot gnu dot org
  2004-02-29  0:16 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-02-05 23:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-02-05 23:25 -------
I believe this is more than an enhancement.  This PR makes it impossible to 
debug code because almost all user variables just disappear. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal


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


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

* [Bug optimization/14016] [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones
  2004-02-04  8:02 [Bug optimization/14016] New: [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones dann at godzilla dot ics dot uci dot edu
                   ` (4 preceding siblings ...)
  2004-02-05 23:25 ` steven at gcc dot gnu dot org
@ 2004-02-29  0:16 ` pinskia at gcc dot gnu dot org
  2004-02-29  0:18 ` amacleod at redhat dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-29  0:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-29 00:16 -------
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-02/msg02616.html>

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug optimization/14016] [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones
  2004-02-04  8:02 [Bug optimization/14016] New: [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones dann at godzilla dot ics dot uci dot edu
                   ` (5 preceding siblings ...)
  2004-02-29  0:16 ` pinskia at gcc dot gnu dot org
@ 2004-02-29  0:18 ` amacleod at redhat dot com
  2004-03-01 16:50 ` amacleod at redhat dot com
  2004-03-01 17:35 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: amacleod at redhat dot com @ 2004-02-29  0:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amacleod at redhat dot com  2004-02-29 00:18 -------
I'll have a more final version shortly, once it runs through final tests. I'll
post what I check In.

Andrew

-- 


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


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

* [Bug optimization/14016] [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones
  2004-02-04  8:02 [Bug optimization/14016] New: [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones dann at godzilla dot ics dot uci dot edu
                   ` (6 preceding siblings ...)
  2004-02-29  0:18 ` amacleod at redhat dot com
@ 2004-03-01 16:50 ` amacleod at redhat dot com
  2004-03-01 17:35 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: amacleod at redhat dot com @ 2004-03-01 16:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amacleod at redhat dot com  2004-03-01 16:50 -------
FInal version is in the attachment:

http://gcc.gnu.org/ml/gcc-patches/2004-03/msg00037.html

-- 


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


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

* [Bug optimization/14016] [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones
  2004-02-04  8:02 [Bug optimization/14016] New: [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones dann at godzilla dot ics dot uci dot edu
                   ` (7 preceding siblings ...)
  2004-03-01 16:50 ` amacleod at redhat dot com
@ 2004-03-01 17:35 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-01 17:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-01 17:35 -------
Fixed so closing.

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


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


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

end of thread, other threads:[~2004-03-01 17:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-04  8:02 [Bug optimization/14016] New: [tree-ssa] User variable get eliminated, only to be replaced with compiler generated ones dann at godzilla dot ics dot uci dot edu
2004-02-04  8:08 ` [Bug optimization/14016] " pinskia at gcc dot gnu dot org
2004-02-04 23:43 ` steven at gcc dot gnu dot org
2004-02-05  0:29 ` steven at gcc dot gnu dot org
2004-02-05  0:30 ` steven at gcc dot gnu dot org
2004-02-05 23:25 ` steven at gcc dot gnu dot org
2004-02-29  0:16 ` pinskia at gcc dot gnu dot org
2004-02-29  0:18 ` amacleod at redhat dot com
2004-03-01 16:50 ` amacleod at redhat dot com
2004-03-01 17:35 ` pinskia 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).