===================================================================
@@ -1541,9 +1541,12 @@ remap_gimple_stmt (gimple *stmt, copy_bo
assignment to the equivalent of the original RESULT_DECL.
If RETVAL is just the result decl, the result decl has
already been set (e.g. a recent "foo (&result_decl, ...)");
- just toss the entire GIMPLE_RETURN. */
+ just toss the entire GIMPLE_RETURN. Likewise for when the
+ call doesn't want the return value. */
if (retval
&& (TREE_CODE (retval) != RESULT_DECL
+ && (!id->call_stmt
+ || gimple_call_lhs (id->call_stmt) != NULL_TREE)
&& (TREE_CODE (retval) != SSA_NAME
|| ! SSA_NAME_VAR (retval)
|| TREE_CODE (SSA_NAME_VAR (retval)) != RESULT_DECL)))
===================================================================
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-einline" } */
+
+void *foo (void *, int);
+static inline void *mcp (void *src, int i)
+{
+ return foo (src, i);
+}
+void bar()
+{
+ int i;
+ mcp (&i, 0);
+}
+
+/* There should be exactly two assignments, one for both
+ the original foo call and the inlined copy (plus a clobber
+ that doesn't match here). In particular bar should look like
+ <bb 2> :
+ _4 = foo (&i, 0);
+ i ={v} {CLOBBER};
+ return; */
+/* { dg-final { scan-tree-dump-times " = " 2 "einline" } } */