public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/3511] Inlined strlen() could be smarter
       [not found] <20010701093600.3511.86251-quiet@bugs.debian.org>
@ 2003-11-16 22:53 ` pinskia at gcc dot gnu dot org
  2003-12-26  3:40 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-16 22:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-16 22:53 -------
This is a O(n_bbs^3 * variables) problem but I would say it is douable.

-- 


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


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

* [Bug optimization/3511] Inlined strlen() could be smarter
       [not found] <20010701093600.3511.86251-quiet@bugs.debian.org>
  2003-11-16 22:53 ` [Bug optimization/3511] Inlined strlen() could be smarter pinskia at gcc dot gnu dot org
@ 2003-12-26  3:40 ` pinskia at gcc dot gnu dot org
  2004-03-08  5:41 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-26  3:40 UTC (permalink / raw)
  To: gcc-bugs



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


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


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

* [Bug optimization/3511] Inlined strlen() could be smarter
       [not found] <20010701093600.3511.86251-quiet@bugs.debian.org>
  2003-11-16 22:53 ` [Bug optimization/3511] Inlined strlen() could be smarter pinskia at gcc dot gnu dot org
  2003-12-26  3:40 ` pinskia at gcc dot gnu dot org
@ 2004-03-08  5:41 ` pinskia at gcc dot gnu dot org
  2004-03-08  5:41 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-08  5:41 UTC (permalink / raw)
  To: gcc-bugs



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


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


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

* [Bug optimization/3511] Inlined strlen() could be smarter
       [not found] <20010701093600.3511.86251-quiet@bugs.debian.org>
                   ` (2 preceding siblings ...)
  2004-03-08  5:41 ` pinskia at gcc dot gnu dot org
@ 2004-03-08  5:41 ` pinskia at gcc dot gnu dot org
  2004-05-16 11:31 ` [Bug tree-optimization/3511] " pinskia at gcc dot gnu dot org
  2005-01-23 15:02 ` steven at gcc dot gnu dot org
  5 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-08  5:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-08 05:40 -------
This shows up in SPEC 2000's 176.gcc, also it might be easier on the tree-ssa:
;; Function mystrlen (mystrlen)

mystrlen (s)
{
  long unsigned int T.0;

<bb 0>:
  if (s_2 == 0B) goto <L0>; else goto <L1>;

<L0>:;

  # s_1 = PHI <s_2(0), ""(1)>;
<L1>:;
  T.0_3 = strlen (s_1);
  return T.0_3;

}

Moving the constant back to the other basic block and splitting thrid basic block and have 
the second basic block goto the last and the first on the false edge goto the new one with 
the call to strlen.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
             Status|SUSPENDED                   |NEW
   Last reconfirmed|2003-11-05 07:41:23         |2004-03-08 05:41:08
               date|                            |


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


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

* [Bug tree-optimization/3511] Inlined strlen() could be smarter
       [not found] <20010701093600.3511.86251-quiet@bugs.debian.org>
                   ` (3 preceding siblings ...)
  2004-03-08  5:41 ` pinskia at gcc dot gnu dot org
@ 2004-05-16 11:31 ` pinskia at gcc dot gnu dot org
  2005-01-23 15:02 ` steven at gcc dot gnu dot org
  5 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-16 11:31 UTC (permalink / raw)
  To: gcc-bugs



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


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


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

* [Bug tree-optimization/3511] Inlined strlen() could be smarter
       [not found] <20010701093600.3511.86251-quiet@bugs.debian.org>
                   ` (4 preceding siblings ...)
  2004-05-16 11:31 ` [Bug tree-optimization/3511] " pinskia at gcc dot gnu dot org
@ 2005-01-23 15:02 ` steven at gcc dot gnu dot org
  5 siblings, 0 replies; 11+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-23 15:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-23 15:01 -------
GCC produces the following code today: 
 
        .section        .rodata.str1.1,"aMS",@progbits,1 
.LC0: 
        .string "" 
        .text 
        .p2align 4,,15 
.globl mystrlen 
        .type   mystrlen, @function 
mystrlen: 
        pushl   %ebp 
        movl    %esp, %ebp 
        movl    8(%ebp), %eax 
        testl   %eax, %eax 
        je      .L6 
        movl    %eax, 8(%ebp) 
        leave 
        jmp     strlen 
        .p2align 4,,7 
.L6: 
        movl    $.LC0, %eax 
        movl    %eax, 8(%ebp) 
        leave 
        jmp     strlen 
        .size   mystrlen, .-mystrlen 
        .ident  "GCC: (GNU) 4.0.0 20050123 (experimental)" 
 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2004-12-13 02:55:40         |2005-01-23 15:01:49
               date|                            |


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


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

* [Bug tree-optimization/3511] Inlined strlen() could be smarter
       [not found] <bug-3511-4380@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2006-10-21 13:23 ` rguenth at gcc dot gnu dot org
@ 2006-10-21 13:24 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-10-21 13:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from rguenth at gcc dot gnu dot org  2006-10-21 13:23 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

* [Bug tree-optimization/3511] Inlined strlen() could be smarter
       [not found] <bug-3511-4380@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2006-05-15 19:23 ` patchapp at dberlin dot org
@ 2006-10-21 13:23 ` rguenth at gcc dot gnu dot org
  2006-10-21 13:24 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-10-21 13:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2006-10-21 13:23 -------
Subject: Bug 3511

Author: rguenth
Date: Sat Oct 21 13:23:41 2006
New Revision: 117932

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117932
Log:
2006-10-21  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/3511
        * tree-ssa-pre.c (phi_translate): Fold CALL_EXPRs that
        got new invariant arguments during PHI translation.

        * gcc.dg/tree-ssa/ssa-pre-15.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-15.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-pre.c


-- 


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


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

* [Bug tree-optimization/3511] Inlined strlen() could be smarter
       [not found] <bug-3511-4380@http.gcc.gnu.org/bugzilla/>
  2006-05-08  9:42 ` rguenth at gcc dot gnu dot org
  2006-05-08 12:39 ` rguenth at gcc dot gnu dot org
@ 2006-05-15 19:23 ` patchapp at dberlin dot org
  2006-10-21 13:23 ` rguenth at gcc dot gnu dot org
  2006-10-21 13:24 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 11+ messages in thread
From: patchapp at dberlin dot org @ 2006-05-15 19:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from patchapp at dberlin dot org  2006-05-15 19:22 -------
Subject: Bug number PR3511

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00295.html


-- 


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


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

* [Bug tree-optimization/3511] Inlined strlen() could be smarter
       [not found] <bug-3511-4380@http.gcc.gnu.org/bugzilla/>
  2006-05-08  9:42 ` rguenth at gcc dot gnu dot org
@ 2006-05-08 12:39 ` rguenth at gcc dot gnu dot org
  2006-05-15 19:23 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-05-08 12:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2006-05-08 12:39 -------
It looks like it was easy.  (so, I have a patch)


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-12-07 03:04:59         |2006-05-08 12:39:11
               date|                            |


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


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

* [Bug tree-optimization/3511] Inlined strlen() could be smarter
       [not found] <bug-3511-4380@http.gcc.gnu.org/bugzilla/>
@ 2006-05-08  9:42 ` rguenth at gcc dot gnu dot org
  2006-05-08 12:39 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-05-08  9:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2006-05-08 09:42 -------
This is really a PRE problem, much like the simplified testcase

char firstchar (const char *s)
{
        if (!s)
                s = "";
        return s[0];
}

where it could record the fact that the load from s[0] is available as
is strlen(s).  Now, if it is worth it is another question.

Danny, will the new VN do anything about this, or make it easier to tackle
this problem?  Now, ccp has moved the assignment into a PHI node, which may
make this more complicated (this is after PRE):

mystrlen (s)
{
  size_t D.1648;

<bb 2>:
  if (s_2 == 0B) goto <L4>; else goto <L3>;

<L4>:;
  goto <bb 4> (<L1>);

<L3>:;

  # s_1 = PHI <s_2(3), &""[0](5)>;
<L1>:;
  #   VUSE <SMT.4_6>;
  D.1648_3 = strlen (s_1);
  return D.1648_3;

}


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dberlin at gcc dot gnu dot
                   |                            |org


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


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

end of thread, other threads:[~2006-10-21 13:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20010701093600.3511.86251-quiet@bugs.debian.org>
2003-11-16 22:53 ` [Bug optimization/3511] Inlined strlen() could be smarter pinskia at gcc dot gnu dot org
2003-12-26  3:40 ` pinskia at gcc dot gnu dot org
2004-03-08  5:41 ` pinskia at gcc dot gnu dot org
2004-03-08  5:41 ` pinskia at gcc dot gnu dot org
2004-05-16 11:31 ` [Bug tree-optimization/3511] " pinskia at gcc dot gnu dot org
2005-01-23 15:02 ` steven at gcc dot gnu dot org
     [not found] <bug-3511-4380@http.gcc.gnu.org/bugzilla/>
2006-05-08  9:42 ` rguenth at gcc dot gnu dot org
2006-05-08 12:39 ` rguenth at gcc dot gnu dot org
2006-05-15 19:23 ` patchapp at dberlin dot org
2006-10-21 13:23 ` rguenth at gcc dot gnu dot org
2006-10-21 13:24 ` rguenth 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).