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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Sandiford <rsand...@gcc.gnu.org>:

https://gcc.gnu.org/g:49e651990a6966936a0273138dd56ac394e57b16

commit r11-8214-g49e651990a6966936a0273138dd56ac394e57b16
Author: Richard Sandiford <richard.sandif...@arm.com>
Date:   Fri Apr 16 12:38:02 2021 +0100

    Mark untyped calls and handle them specially [PR98689]

    This patch fixes a regression introduced by the rtl-ssa patches.
    It was seen on HPPA but it might be latent elsewhere.

    The problem is that the traditional way of expanding an untyped_call
    is to emit sequences like:

       (call (mem (symbol_ref "foo")))
       (set (reg pseudo1) (reg result1))
       ...
       (set (reg pseudon) (reg resultn))

    The ABI specifies that result1..resultn are clobbered by the call but
    nothing in the RTL indicates that result1..resultn are the results
    of the call.  Normally, using a clobbered value gives undefined results,
    but in this case the results are well-defined and matter for correctness.

    This seems like a niche case, so I think it would be better to mark
    it explicitly rather than try to detect it heuristically.

    Note that in expand_builtin_apply we already have an rtx_insn *,
    so it doesn't matter whether we call emit_call_insn or emit_insn.
    Calling emit_insn seems more natural now that the gen_* call
    has been split out.  It also matches later code in the function.

    gcc/
            PR rtl-optimization/98689
            * reg-notes.def (UNTYPED_CALL): New note.
            * combine.c (distribute_notes): Handle it.
            * emit-rtl.c (try_split): Likewise.
            * rtlanal.c (rtx_properties::try_to_add_insn): Likewise.  Assume
            that calls with the note implicitly set all return value registers.
            * builtins.c (expand_builtin_apply): Add a REG_UNTYPED_CALL
            to untyped_calls.
  • [Bug middle-end/98689] [11 Regr... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to