public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug rtl-optimization/44374] New: Hoist same instructions in different branches @ 2010-06-02 8:20 carrot at google dot com 2010-06-02 8:21 ` [Bug rtl-optimization/44374] " carrot at google dot com ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: carrot at google dot com @ 2010-06-02 8:20 UTC (permalink / raw) To: gcc-bugs Compile the attached test case with options -march=armv7-a -mthumb -Os, this code snippet if (native) dlmalloc_walk_heap(heap_chunk_callback, (void *)&ctx); else dvmHeapSourceWalk(heap_chunk_callback, (void *)&ctx); is compiled to: cbz r5, .L2 ldr r0, .L4 // A mov r1, sp // B bl dlmalloc_walk_heap b .L1 .L2: ldr r0, .L4 // C mov r1, sp // D bl dvmHeapSourceWalk .L1: add sp, sp, #44 pop {r4, r5, pc} .L5: .align 2 .L4: .word heap_chunk_callback Note that instructions AB are equal to instructions CD, if we move the previous conditional branch after B, then CD can be removed. Option -O2 and target arm have the same problem. Which pass should do this optimization? pass_rtl_hoist? -- Summary: Hoist same instructions in different branches Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: carrot at google dot com GCC build triplet: i686-linux GCC host triplet: i686-linux GCC target triplet: arm-eabi http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44374 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/44374] Hoist same instructions in different branches 2010-06-02 8:20 [Bug rtl-optimization/44374] New: Hoist same instructions in different branches carrot at google dot com @ 2010-06-02 8:21 ` carrot at google dot com 2010-06-02 8:54 ` steven at gcc dot gnu dot org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: carrot at google dot com @ 2010-06-02 8:21 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from carrot at google dot com 2010-06-02 08:20 ------- Created an attachment (id=20805) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20805&action=view) test case -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44374 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/44374] Hoist same instructions in different branches 2010-06-02 8:20 [Bug rtl-optimization/44374] New: Hoist same instructions in different branches carrot at google dot com 2010-06-02 8:21 ` [Bug rtl-optimization/44374] " carrot at google dot com @ 2010-06-02 8:54 ` steven at gcc dot gnu dot org 2010-09-23 10:05 ` bernds at gcc dot gnu dot org 2010-09-23 10:08 ` bernds at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: steven at gcc dot gnu dot org @ 2010-06-02 8:54 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from steven at gcc dot gnu dot org 2010-06-02 08:54 ------- HOIST should do this. You will have to check in the RTL dumps that the code is exposed properly to this optimization. -- steven at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2010-06-02 08:54:40 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44374 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/44374] Hoist same instructions in different branches 2010-06-02 8:20 [Bug rtl-optimization/44374] New: Hoist same instructions in different branches carrot at google dot com 2010-06-02 8:21 ` [Bug rtl-optimization/44374] " carrot at google dot com 2010-06-02 8:54 ` steven at gcc dot gnu dot org @ 2010-09-23 10:05 ` bernds at gcc dot gnu dot org 2010-09-23 10:08 ` bernds at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: bernds at gcc dot gnu dot org @ 2010-09-23 10:05 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from bernds at gcc dot gnu dot org 2010-09-23 10:04 ------- Subject: Bug 44374 Author: bernds Date: Thu Sep 23 10:04:33 2010 New Revision: 164552 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164552 Log: PR rtl-optimization/44374 * basic-block.h (enum bb_flags): Add BB_MODIFIED. * df-core.c (df_set_bb_dirty): Set it. * ifcvt.c (find_memory): Remove function. (dead_or_predicable): Use can_move_insns_across. * df.h (can_move_insns_across): Declare function. * cfgcleanup.c (block_was_dirty): New static variable. (try_crossjump_bb, try_forward_edges): Test BB_MODIFIED flag rather than df_get_bb_dirty. (try_head_merge_bb): New static function. (try_optimize_cfg): Call it. Call df_analyze if block_was_dirty is set. * df-problems.c: Include "target.h" (df_simulate_find_uses): New static function. (MEMREF_NORMAL, MEMREF_VOLATILE): New macros. (find_memory, find_memory_store): New static functions. (can_move_insns_across): New function. * Makefile.in (df-problems.o): Update dependencies. testsuite/ PR rtl-optimization/44374 * gcc.target/arm/headmerge-1.c: New test. * gcc.target/arm/headmerge-2.c: New test. * gcc.target/i386/headmerge-1.c: New test. * gcc.target/i386/headmerge-2.c: New test. Added: trunk/gcc/config/i386/core2.md trunk/gcc/testsuite/gcc.target/arm/headmerge-1.c trunk/gcc/testsuite/gcc.target/arm/headmerge-2.c trunk/gcc/testsuite/gcc.target/i386/headmerge-1.c trunk/gcc/testsuite/gcc.target/i386/headmerge-2.c Modified: trunk/gcc/ChangeLog trunk/gcc/Makefile.in trunk/gcc/basic-block.h trunk/gcc/cfgcleanup.c trunk/gcc/df-core.c trunk/gcc/df-problems.c trunk/gcc/df.h trunk/gcc/ifcvt.c trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44374 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/44374] Hoist same instructions in different branches 2010-06-02 8:20 [Bug rtl-optimization/44374] New: Hoist same instructions in different branches carrot at google dot com ` (2 preceding siblings ...) 2010-09-23 10:05 ` bernds at gcc dot gnu dot org @ 2010-09-23 10:08 ` bernds at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: bernds at gcc dot gnu dot org @ 2010-09-23 10:08 UTC (permalink / raw) To: gcc-bugs ------- Comment #4 from bernds at gcc dot gnu dot org 2010-09-23 10:08 ------- Fixed. -- bernds at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44374 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-09-23 10:08 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-06-02 8:20 [Bug rtl-optimization/44374] New: Hoist same instructions in different branches carrot at google dot com 2010-06-02 8:21 ` [Bug rtl-optimization/44374] " carrot at google dot com 2010-06-02 8:54 ` steven at gcc dot gnu dot org 2010-09-23 10:05 ` bernds at gcc dot gnu dot org 2010-09-23 10:08 ` bernds 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).