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
* [Bug tree-optimization/42646] Jump threading breaks canonical loop forms
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 ` joefoxreal at gmail dot com
2010-01-08 1:40 ` joefoxreal at gmail dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: joefoxreal at gmail dot com @ 2010-01-07 14:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from joefoxreal at gmail dot com 2010-01-07 14:29 -------
Created an attachment (id=19498)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19498&action=view)
cfg of the function foo
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42646
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/42646] Jump threading breaks canonical loop forms
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
3 siblings, 0 replies; 6+ messages in thread
From: joefoxreal at gmail dot com @ 2010-01-08 1:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from joefoxreal at gmail dot com 2010-01-08 01:40 -------
Created an attachment (id=19504)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19504&action=view)
the cfg of foo.c.079t.copyrename3
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42646
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/42646] Jump threading breaks canonical loop forms
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
3 siblings, 0 replies; 6+ messages in thread
From: joefoxreal at gmail dot com @ 2010-01-08 1:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from joefoxreal at gmail dot com 2010-01-08 01:41 -------
Created an attachment (id=19505)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19505&action=view)
the cfg of foo.c.080t.dom1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42646
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/42646] Jump threading breaks canonical loop forms
2010-01-07 14:27 [Bug tree-optimization/42646] New: Jump threading breaks canonical loop forms joefoxreal at gmail dot com
` (2 preceding siblings ...)
2010-01-08 1:42 ` joefoxreal at gmail dot com
@ 2010-01-08 11:53 ` rguenth at gcc dot gnu dot org
3 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-08 11:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from rguenth at gcc dot gnu dot org 2010-01-08 11:52 -------
It just means that we shouldn't thread to the header but always to the latch
block. Note that this restriction should probably be restricted to the
threading before loop optimizations. Or the 1st jump threading should simply
avoid to thread over backedges (equivalent to removing the 1st DOM pass -
though
there is interesting fallout regarding jump-threading / loop header copying
pass ordering).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42646
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/42646] Jump threading breaks canonical loop forms
[not found] <bug-42646-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-05 21:36 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-05 21:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42646
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This seems to finally have been fixed on the trunk.
^ permalink raw reply [flat|nested] 6+ messages in thread
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).