public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/42646]  New: Jump threading breaks canonical loop forms
@ 2010-01-07 14:27 joefoxreal at gmail dot com
  2010-01-07 14:29 ` [Bug tree-optimization/42646] " joefoxreal at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: joefoxreal at gmail dot com @ 2010-01-07 14:27 UTC (permalink / raw)
  To: gcc-bugs

pass_dominator tries to thread jumps.But sometimes this will cause that the
loop's exit bb does not dominator its latch bb again. 

-------------------------------------
void
foo (int x)
{
 int i;

 for (i=0; i < 10 ; i++)
   if (x)
     {
       if (i == 0)
         fun_1 ();
       else
         fun_2 ();
     }
}
---------------------------------------
$ gcc -O3 -S foo.c
$ cat foo.s

       .file   "foo.c"
       .text
       .p2align 4,,15
.globl foo
       .type   foo, @function
foo:
       pushl   %ebp
       movl    %esp, %ebp
       pushl   %ebx
       movl    $1, %ebx
       subl    $4, %esp
       movl    8(%ebp), %eax
       testl   %eax, %eax
       jne     .L3
       addl    $4, %esp
       popl    %ebx
       popl    %ebp
       ret
       .p2align 4,,7
       .p2align 3
.L7:
       call    fun_1
.L5:
       addl    $1, %ebx
.L3:
       cmpl    $1, %ebx
       je      .L7
       call    fun_2
       cmpl    $9, %ebx
       jle     .L5
       addl    $4, %esp
       popl    %ebx
       popl    %ebp
       ret
       .size   foo, .-foo
       .ident  "GCC: (GNU) 4.5.0 20100107 (experimental)"
       .section        .note.GNU-stack,"",@progbits
-------------------------------------------
$ gcc -O3 -fno-tree-dominator-opts -S foo.c
$ cat foo.s

       .file   "foo.c"
       .text
       .p2align 4,,15
.globl foo
       .type   foo, @function
foo:
       pushl   %ebp
       movl    %esp, %ebp
       subl    $8, %esp
       movl    8(%ebp), %eax
       testl   %eax, %eax
       je      .L1
       call    fun_1
       call    fun_2
       .p2align 4,,5
       call    fun_2
       .p2align 4,,5
       call    fun_2
       .p2align 4,,5
       call    fun_2
       .p2align 4,,5
       call    fun_2
       .p2align 4,,5
       call    fun_2
       .p2align 4,,5
       call    fun_2
       .p2align 4,,5
       call    fun_2
       leave
       jmp     fun_2
       .p2align 4,,7
       .p2align 3
.L1:
       leave
       ret
       .size   foo, .-foo
       .ident  "GCC: (GNU) 4.5.0 20100107 (experimental)"
       .section        .note.GNU-stack,"",@progbits
-------------------------------------------
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/eric/install/trunk/libexec/gcc/i686-pc-linux-gnu/4.5.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../trunk/configure --prefix=/home/eric/install/trunk
--with-gmp=/home/eric/install/generic
--with-mpfr=/home/eric/install/generic
--with-mpc=/home/eric/install/generic/ --enable-languages=c
Thread model: posix
gcc version 4.5.0 20100107 (experimental) (GCC)


-- 
           Summary: Jump threading breaks canonical loop forms
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: joefoxreal at gmail dot com
GCC target triplet: i686-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <bug-42646-4@http.gcc.gnu.org/bugzilla/>]

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-07 14:27 [Bug tree-optimization/42646] New: Jump threading breaks canonical loop forms joefoxreal at gmail dot com
2010-01-07 14:29 ` [Bug tree-optimization/42646] " joefoxreal at gmail dot com
2010-01-08  1:40 ` joefoxreal at gmail dot com
2010-01-08  1:42 ` joefoxreal at gmail dot com
2010-01-08 11:53 ` rguenth at gcc dot gnu dot org
     [not found] <bug-42646-4@http.gcc.gnu.org/bugzilla/>
2021-08-05 21:36 ` pinskia at gcc dot gnu.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).