public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "joefoxreal at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/42646] New: Jump threading breaks canonical loop forms Date: Thu, 07 Jan 2010 14:27:00 -0000 [thread overview] Message-ID: <bug-42646-15392@http.gcc.gnu.org/bugzilla/> (raw) 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
next reply other threads:[~2010-01-07 14:27 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-01-07 14:27 joefoxreal at gmail dot com [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-42646-15392@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).