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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:decd8fb0128870d0d768ba53dae626913d6d9c54

commit r11-7274-gdecd8fb0128870d0d768ba53dae626913d6d9c54
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Thu Feb 18 09:16:28 2021 +0100

    i386: Fix up df uses in i386 splitters [PR99104]

    The following testcase started ICEing with my recent changes to enable
    split4 after sel-sched, but it seems the bug is more general.
    Some of the i386 splitter condition functions use and rely on df, but
    the split passes don't really df_analyze/df_finish_pass, so the DF info
    may be stale or not computed at all - the particular ICE is because
    there is a new bb and df_get_live_out (bb) returns NULL on it as the
    live or lr problem has not been computed yet.

    This patch fixes it by not calling ix86_ok_to_clobber_flags from
    ix86_avoid_lea_for_add where it wasn't ever needed because the splitters
    using that function as condition have (clobber FLAGS) in their pattern.
    And, changes the ix86_avoid_lea_for_addr using splitter from normal
splitter
    to peephole2 splitter that uses peep2_regno_dead_p infrastructure to
    determine if FLAGS is dead.  Also, it saves and restores recog_data
    variable around the call to distance_non_agu_define and doesn't call
    extract_insn_data there, because split_insns or peephole2_insns just
    clear recog_data.insn and then fill in recog_data.operand array, and so
    might not match what extract_insn will do on the insn at all.

    2021-02-18  Jakub Jelinek  <ja...@redhat.com>

            PR target/99104
            * config/i386/i386.c (distance_non_agu_define): Don't call
            extract_insn_cached here.
            (ix86_lea_outperforms): Save and restore recog_data around call
            to distance_non_agu_define and distance_agu_use.
            (ix86_ok_to_clobber_flags): Remove.
            (ix86_avoid_lea_for_add): Don't call ix86_ok_to_clobber_flags.
            (ix86_avoid_lea_for_addr): Likewise.  Adjust function comment.
            * config/i386/i386.md (*lea<mode>): Change from
define_insn_and_split
            into define_insn.  Move the splitting to define_peephole2 and
            check there using peep2_regno_dead_p if FLAGS_REG is dead.

            * gcc.dg/pr99104.c: New test.

Reply via email to