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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ messages in thread
[parent not found: <bug-44374-4@http.gcc.gnu.org/bugzilla/>]
* [Bug rtl-optimization/44374] Hoist same instructions in different branches [not found] <bug-44374-4@http.gcc.gnu.org/bugzilla/> @ 2010-11-03 18:25 ` hjl.tools at gmail dot com 2010-12-14 0:23 ` bernds at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 9+ messages in thread From: hjl.tools at gmail dot com @ 2010-11-03 18:25 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44374 H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | --- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> 2010-11-03 18:25:22 UTC --- Patch was reverted: http://gcc.gnu.org/ml/gcc-cvs/2010-11/msg00145.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/44374] Hoist same instructions in different branches [not found] <bug-44374-4@http.gcc.gnu.org/bugzilla/> 2010-11-03 18:25 ` hjl.tools at gmail dot com @ 2010-12-14 0:23 ` bernds at gcc dot gnu.org 2011-04-02 13:47 ` steven at gcc dot gnu.org 2011-04-02 13:51 ` bernds at gcc dot gnu.org 3 siblings, 0 replies; 9+ messages in thread From: bernds at gcc dot gnu.org @ 2010-12-14 0:23 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44374 --- Comment #6 from Bernd Schmidt <bernds at gcc dot gnu.org> 2010-12-14 00:23:48 UTC --- Author: bernds Date: Tue Dec 14 00:23:40 2010 New Revision: 167779 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167779 Log: gcc/ PR rtl-optimization/44374 Reapply patch with fixes. * 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. (flow_find_head_matching_sequence): Test for epilogue notes. (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. gcc/testsuite/ PR rtl-optimization/44374 Reapply patch with fixes. * 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/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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/44374] Hoist same instructions in different branches [not found] <bug-44374-4@http.gcc.gnu.org/bugzilla/> 2010-11-03 18:25 ` hjl.tools at gmail dot com 2010-12-14 0:23 ` bernds at gcc dot gnu.org @ 2011-04-02 13:47 ` steven at gcc dot gnu.org 2011-04-02 13:51 ` bernds at gcc dot gnu.org 3 siblings, 0 replies; 9+ messages in thread From: steven at gcc dot gnu.org @ 2011-04-02 13:47 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44374 Steven Bosscher <steven at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bernds at gcc dot gnu.org, | |steven at gcc dot gnu.org --- Comment #7 from Steven Bosscher <steven at gcc dot gnu.org> 2011-04-02 13:47:01 UTC --- Is this now fixed, or are there reasons why the bug status is REOPENED? ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/44374] Hoist same instructions in different branches [not found] <bug-44374-4@http.gcc.gnu.org/bugzilla/> ` (2 preceding siblings ...) 2011-04-02 13:47 ` steven at gcc dot gnu.org @ 2011-04-02 13:51 ` bernds at gcc dot gnu.org 3 siblings, 0 replies; 9+ messages in thread From: bernds at gcc dot gnu.org @ 2011-04-02 13:51 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44374 Bernd Schmidt <bernds at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED --- Comment #8 from Bernd Schmidt <bernds at gcc dot gnu.org> 2011-04-02 13:51:21 UTC --- Fixed again. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-04-02 13:51 UTC | newest] Thread overview: 9+ 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 [not found] <bug-44374-4@http.gcc.gnu.org/bugzilla/> 2010-11-03 18:25 ` hjl.tools at gmail dot com 2010-12-14 0:23 ` bernds at gcc dot gnu.org 2011-04-02 13:47 ` steven at gcc dot gnu.org 2011-04-02 13:51 ` bernds 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).