[Bug target/83496] MIPS BE: wrong code generates under "-Os -mbranch-cost=1"

paul.hua.gm at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jan 23 03:43:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83496

--- Comment #11 from Paul Hua <paul.hua.gm at gmail dot com> ---

> 
> Actually, I think that assembly looks unaffected by the issue.
> 
Right.


> I have some doubts about the commits mentioned in this thread as well.
> r240965 looks like it simply changes the code generator in a way that makes
> the bug appear (without being the root cause of it) by affecting how and
> where branches are generated.

Yes, r240965 just to avoid usage of branch likely insns, not the root cause of
this bug.

so, I bisecting with -mno-branch-likely. (-fpreprocessed test.i -mel -quiet
-dumpbase test.c -mbranch-cost=1 -mips32r2 -mabi=32 -mllsc -mno-shared -auxbase
test -mno-branch-likely -Os -version -o test.s)

Started with r235905.

Author: segher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed May 4 20:57:08 2016 +0000

    shrink-wrap: Remove complicated simple_return manipulations

    Now that cfgcleanup knows how to optimize with return statements, the
    epilogue insertion code doesn't have to deal with it itself anymore.


        * function.c (emit_use_return_register_into_block): Delete.
        (gen_return_pattern): Delete.
        (emit_return_into_block): Delete.
        (active_insn_between): Delete.
        (convert_jumps_to_returns): Delete.
        (emit_return_for_exit): Delete.
        (thread_prologue_and_epilogue_insns): Delete all code dealing with
        simple_return for shrink-wrapped blocks.
        * shrink-wrap.c (try_shrink_wrapping): Insert simple_return at the
        end of blocks that need one.
        (get_unconverted_simple_return): Delete.
        (convert_to_simple_return): Delete.
        * shrink-wrap.c (get_unconverted_simple_return): Delete declaration.
        (convert_to_simple_return): Ditto.


More information about the Gcc-bugs mailing list