re PR rtl-optimization/21848 (load_mems / replace_loop_mems bug causes miscompilation...
authorJ"orn Rennecke <joern.rennecke@st.com>
Fri, 22 Jul 2005 12:15:37 +0000 (12:15 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Fri, 22 Jul 2005 12:15:37 +0000 (13:15 +0100)
PR rtl-optimization/21848
* calls.c (emit_library_call_value_1): For const functions, add
USEs of the stack slots to CALL_INSN_FUNCTION_USAGE.

From-SVN: r102281

gcc/ChangeLog
gcc/calls.c

index f49ff821d4b6fc83b14e2061387566745e6469a1..afaf91869dadf6cb8227fe2ce072d940fa2041b5 100644 (file)
@@ -1,5 +1,9 @@
 2005-07-22  J"orn Rennecke <joern.rennecke@st.com>
 
+       PR rtl-optimization/21848
+       * calls.c (emit_library_call_value_1): For const functions, add
+       USEs of the stack slots to CALL_INSN_FUNCTION_USAGE.
+
        PR rtl-optimization/22445
        * cselib.c (target.h): Include.
        (rtx_equal_for_cselib_p): Allow commutative matches.
index f21426fa995d1ee4655d072d45016f4a3ed0af74..8e87886de1d0a49f7e76f6fb67b9115cf7480ea5 100644 (file)
@@ -3623,6 +3623,28 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
              stack_usage_map[i] = 1;
 
          NO_DEFER_POP;
+
+         if (flags & ECF_CONST)
+           {
+             rtx use;
+
+             /* Indicate argument access so that alias.c knows that these
+                values are live.  */
+             if (argblock)
+               use = plus_constant (argblock,
+                                    argvec[argnum].locate.offset.constant);
+             else
+               /* When arguemnts are pushed, trying to tell alias.c where
+                  exactly this argument is won't work, because the
+                  auto-increment causes confusion.  So we merely indicate
+                  that we access something with a known mode somewhere on
+                  the stack.  */
+               use = gen_rtx_PLUS (Pmode, virtual_outgoing_args_rtx,
+                                   gen_rtx_SCRATCH (Pmode));
+             use = gen_rtx_MEM (argvec[argnum].mode, use);
+             use = gen_rtx_USE (VOIDmode, use);
+             call_fusage = gen_rtx_EXPR_LIST (VOIDmode, use, call_fusage);
+           }
        }
     }