The attached patch fixes PR middle-end/71712.  We need to invalidate the 
argument slots in
const/pure calls as they are owned by the callee.  The caller can't assume they 
are preserved
across the call.  Fix is similar to that for PR71532.

Tested on hppa-unknown-linux-gnu.

Okay for trunk?

Dave
--
John David Anglin       dave.ang...@bell.net

2016-08-23  John David Anglin  <dang...@gcc.gnu.org>

        PR middle-end/71732
        * cselib.c (cselib_process_insn): Invalidate argument slots for
        const/pure calls.

Index: cselib.c
===================================================================
--- cselib.c    (revision 238612)
+++ cselib.c    (working copy)
@@ -2659,6 +2659,13 @@
       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));
     }
 
   cselib_record_sets (insn);

Reply via email to