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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, the problem is in cselib.
cselib_process_insn for calls does:
      /* Since it is not clear how cselib is going to be used, be
         conservative here and treat looping pure or const functions
         as if they were regular functions.  */
      if (RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)
          || !(RTL_CONST_OR_PURE_CALL_P (insn)))
        cselib_invalidate_mem (callmem);
      else
        /* For const/pure calls, invalidate any argument slots because
           they are owned by the callee.  */
        for (x = CALL_INSN_FUNCTION_USAGE (insn); x; x = XEXP (x, 1))
          if (GET_CODE (XEXP (x, 0)) == USE
              && MEM_P (XEXP (XEXP (x, 0), 0)))
            cselib_invalidate_mem (XEXP (XEXP (x, 0), 0));
For non-pure/const calls callmem is gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH
(VOIDmode))
and so it invalidates everything, but here we have const/pure calls and
invalidating just the argument slot isn't enough.

Reply via email to