public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14840] New: [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself
@ 2004-04-03 23:34 kazu at cs dot umass dot edu
  2004-04-03 23:49 ` [Bug optimization/14840] " kazu at cs dot umass dot edu
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-04-03 23:34 UTC (permalink / raw)
  To: gcc-bugs

In fold-const.i.t54.vars, I see

164 occurrences of tree_code_type[CST]
142 occurrences of tree_code_length[CST]

with checking enabled.

One possible solution is to

1. define tree_code_type as we do now,
2. define static_tree_code_type like tree_code_type but with static,
3. define TREE_CODE_CLASS like

#define TREE_CODE_CLASS(CODE)			\
  (__builtin_constant_p (CODE)			\
   ? static_tree_code_type[(int) (CODE)]	\
   : tree_code_type[(int) (CODE)])

4. fold static_const_array[CST] in CCP or wherever appropriate.
5. and then make sure that static_const_array is never emitted to asm
   (as its only use is to be folded.)

-- 
           Summary: [tree-ssa] fold tree_code_type[CST] and
                    tree_code_length[CST] in GCC itself
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Keywords: pessimizes-code
          Severity: enhancement
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug optimization/14840] [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself
  2004-04-03 23:34 [Bug optimization/14840] New: [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself kazu at cs dot umass dot edu
@ 2004-04-03 23:49 ` kazu at cs dot umass dot edu
  2004-04-04  2:59 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-04-03 23:49 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |14841


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


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

* [Bug optimization/14840] [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself
  2004-04-03 23:34 [Bug optimization/14840] New: [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself kazu at cs dot umass dot edu
  2004-04-03 23:49 ` [Bug optimization/14840] " kazu at cs dot umass dot edu
@ 2004-04-04  2:59 ` pinskia at gcc dot gnu dot org
  2004-04-04  6:51 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-04  2:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-04 02:59 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |compile-time-hog
   Last reconfirmed|0000-00-00 00:00:00         |2004-04-04 02:59:45
               date|                            |


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


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

* [Bug optimization/14840] [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself
  2004-04-03 23:34 [Bug optimization/14840] New: [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself kazu at cs dot umass dot edu
  2004-04-03 23:49 ` [Bug optimization/14840] " kazu at cs dot umass dot edu
  2004-04-04  2:59 ` pinskia at gcc dot gnu dot org
@ 2004-04-04  6:51 ` pinskia at gcc dot gnu dot org
  2004-04-04  8:52 ` kazu at cs dot umass dot edu
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-04  6:51 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |tree-ssa


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


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

* [Bug optimization/14840] [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself
  2004-04-03 23:34 [Bug optimization/14840] New: [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself kazu at cs dot umass dot edu
                   ` (2 preceding siblings ...)
  2004-04-04  6:51 ` pinskia at gcc dot gnu dot org
@ 2004-04-04  8:52 ` kazu at cs dot umass dot edu
  2004-04-04 16:11 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-04-04  8:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2004-04-04 08:52 -------
In other words, once 14841 is taken care of, the following patch should be enough.

Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.342.2.182
diff -u -r1.342.2.182 tree.h
*** tree.h	1 Apr 2004 17:33:58 -0000	1.342.2.182
--- tree.h	4 Apr 2004 08:50:00 -0000
***************
*** 52,58 ****
  
  #define MAX_TREE_CODES 256
  extern const char tree_code_type[];
! #define TREE_CODE_CLASS(CODE)	tree_code_type[(int) (CODE)]
  
  /* Returns nonzero iff CLASS is the tree-code class of an
     expression.  */
--- 52,71 ----
  
  #define MAX_TREE_CODES 256
  extern const char tree_code_type[];
! 
! #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
! 
! static const char static_tree_code_type[] = {
! #include "tree.def"
!   'x',
! #include "c-common.def"
! };
! #undef DEFTREECODE
! 
! #define TREE_CODE_CLASS(CODE)			\
!   (__builtin_constant_p (CODE)			\
!    ? static_tree_code_type[(int) (CODE)]	\
!    : tree_code_type[(int) (CODE)])
  
  /* Returns nonzero iff CLASS is the tree-code class of an
     expression.  */


-- 


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


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

* [Bug optimization/14840] [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself
  2004-04-03 23:34 [Bug optimization/14840] New: [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself kazu at cs dot umass dot edu
                   ` (3 preceding siblings ...)
  2004-04-04  8:52 ` kazu at cs dot umass dot edu
@ 2004-04-04 16:11 ` pinskia at gcc dot gnu dot org
  2004-05-24 19:43 ` [Bug other/14840] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-04 16:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-04 16:11 -------
Note the definifition for static_tree_code_type and TREE_CODE_CLASS is wrong for C++, Java, 
Objective-C and some all other languages besides C.
It should be more like which is right for every language but only folds to the constant for the language 
independent trees:
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,

static const char static_tree_code_type[] = {
#include "tree.def"
  'x'
};
#undef DEFTREECODE
 
#define TREE_CODE_CLASS(CODE)                 \
  (__builtin_constant_p (CODE)		      \
   && (CODE) <= LAST_AND_UNUSED_TREE_CODE     \
   ? static_tree_code_type[(int) (CODE)]      \
   : tree_code_type[(int) (CODE)])

-- 


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


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

* [Bug other/14840] [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself
  2004-04-03 23:34 [Bug optimization/14840] New: [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself kazu at cs dot umass dot edu
                   ` (4 preceding siblings ...)
  2004-04-04 16:11 ` pinskia at gcc dot gnu dot org
@ 2004-05-24 19:43 ` pinskia at gcc dot gnu dot org
  2004-07-22  6:33 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-24 19:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-24 01:23 -------
I will submit a patch for this when PR14841 gets fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Target Milestone|3.5.0                       |---


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


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

* [Bug other/14840] [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself
  2004-04-03 23:34 [Bug optimization/14840] New: [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself kazu at cs dot umass dot edu
                   ` (5 preceding siblings ...)
  2004-05-24 19:43 ` [Bug other/14840] " pinskia at gcc dot gnu dot org
@ 2004-07-22  6:33 ` pinskia at gcc dot gnu dot org
  2005-05-07  5:14 ` [Bug middle-end/14840] " kazu at cs dot umass dot edu
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-22  6:33 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 14840 depends on bug 9059, which changed state.

Bug 9059 Summary: unused arrays not optimized away
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9059

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

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


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

* [Bug middle-end/14840] [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself
  2004-04-03 23:34 [Bug optimization/14840] New: [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself kazu at cs dot umass dot edu
                   ` (6 preceding siblings ...)
  2004-07-22  6:33 ` pinskia at gcc dot gnu dot org
@ 2005-05-07  5:14 ` kazu at cs dot umass dot edu
  2005-05-08 17:00 ` pinskia at gcc dot gnu dot org
  2005-05-08 21:30 ` kazu at cs dot umass dot edu
  9 siblings, 0 replies; 11+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-05-07  5:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2005-05-07 05:14 -------
In *.final_cleanup of cc1-i files with --enable-checking, I see

1308 occurrences of tree_code_type[CST]
 979 occurrences of tree_code_length[CST]


-- 


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


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

* [Bug middle-end/14840] [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself
  2004-04-03 23:34 [Bug optimization/14840] New: [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself kazu at cs dot umass dot edu
                   ` (7 preceding siblings ...)
  2005-05-07  5:14 ` [Bug middle-end/14840] " kazu at cs dot umass dot edu
@ 2005-05-08 17:00 ` pinskia at gcc dot gnu dot org
  2005-05-08 21:30 ` kazu at cs dot umass dot edu
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-08 17:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-08 17:00 -------
(In reply to comment #5)
> In *.final_cleanup of cc1-i files with --enable-checking, I see
> 
> 1308 occurrences of tree_code_type[CST]

On PPC-darwin I get about 1251.

Next up the patch for tree_code_length.

-- 


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


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

* [Bug middle-end/14840] [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself
  2004-04-03 23:34 [Bug optimization/14840] New: [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself kazu at cs dot umass dot edu
                   ` (8 preceding siblings ...)
  2005-05-08 17:00 ` pinskia at gcc dot gnu dot org
@ 2005-05-08 21:30 ` kazu at cs dot umass dot edu
  9 siblings, 0 replies; 11+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-05-08 21:30 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 14840 depends on bug 14841, which changed state.

Bug 14841 Summary: [tree-ssa] const_array[CST] is not folded
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14841

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

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


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

end of thread, other threads:[~2005-05-08 21:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-03 23:34 [Bug optimization/14840] New: [tree-ssa] fold tree_code_type[CST] and tree_code_length[CST] in GCC itself kazu at cs dot umass dot edu
2004-04-03 23:49 ` [Bug optimization/14840] " kazu at cs dot umass dot edu
2004-04-04  2:59 ` pinskia at gcc dot gnu dot org
2004-04-04  6:51 ` pinskia at gcc dot gnu dot org
2004-04-04  8:52 ` kazu at cs dot umass dot edu
2004-04-04 16:11 ` pinskia at gcc dot gnu dot org
2004-05-24 19:43 ` [Bug other/14840] " pinskia at gcc dot gnu dot org
2004-07-22  6:33 ` pinskia at gcc dot gnu dot org
2005-05-07  5:14 ` [Bug middle-end/14840] " kazu at cs dot umass dot edu
2005-05-08 17:00 ` pinskia at gcc dot gnu dot org
2005-05-08 21:30 ` kazu at cs dot umass dot edu

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