[Bug rtl-optimization/94740] ICE on testsuite/gcc.dg/sso/t5.c with -mcpu=future -mpcrel -O1

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 30 19:33:05 GMT 2020


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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Richard Sandiford
<rsandifo@gcc.gnu.org>:

https://gcc.gnu.org/g:591d857164c37cd0bb96da2a293148e01f280e0f

commit r10-8080-g591d857164c37cd0bb96da2a293148e01f280e0f
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Thu Apr 30 20:32:49 2020 +0100

    cse: Use simplify_replace_fn_rtx to process notes [PR94740]

    cse_process_notes did a very simple substitution, which in the wrong
    circumstances could create non-canonical RTL and invalid MEMs.
    Various sticking plasters have been applied to cse_process_notes_1
    to handle cases like ZERO_EXTEND, SIGN_EXTEND and UNSIGNED_FLOAT,
    but I think this PR is a plaster too far.

    The code is trying hard to avoid creating unnecessary rtl, which of
    course is a good thing.  If we continue to do that, then we can end
    up changing subexpressions while keeping the containing rtx.
    This in turn means that validate_change will be a no-op on the
    containing rtx, even if its contents have changed.  So in these
    cases we have to apply validate_change to the individual subexpressions.

    On the other hand, if we always apply validate_change to the
    individual subexpressions, we'll end up calling validate_change
    on something before it has been simplified and canonicalised.
    And that's one of the situations we're trying to avoid.

    There might be a middle ground in which we queue the validate_changes
    as part of a group, and so can cancel the pending validate_changes
    for subexpressions if there's a change in the outer expression.
    But that seems even more ad-hoc than the current code.
    It would also be quite an invasive change.

    I think the best thing is just to hook into the existing
    simplify_replace_fn_rtx function, keeping the REG and MEM handling
    from cse_process_notes_1 essentially unchanged.  It can generate
    more redundant rtl when a simplification takes place, but it has
    the advantage of being relative well-used code (both directly
    and via simplify_replace_rtx).

    2020-04-30  Richard Sandiford  <richard.sandiford@arm.com>

    gcc/
            PR rtl-optimization/94740
            * cse.c (cse_process_notes_1): Replace with...
            (cse_process_note_1): ...this new function, acting as a
            simplify_replace_fn_rtx callback to process_note.  Handle only
            REGs and MEMs directly.  Validate the MEM if cse_process_note
            changes its address.
            (cse_process_notes): Replace with...
            (cse_process_note): ...this new function.
            (cse_extended_basic_block): Update accordingly, iterating over
            the register notes and passing individual notes to
cse_process_note.


More information about the Gcc-bugs mailing list