diff --git a/gcc/ipa-param-manipulation.c b/gcc/ipa-param-manipulation.c
index 0a265e26c4f..b43c1323ef1 100644
--- a/gcc/ipa-param-manipulation.c
+++ b/gcc/ipa-param-manipulation.c
@@ -466,6 +466,8 @@ transitive_split_p (vec<ipa_param_performed_split, va_gc> *performed_splits,
 		    tree expr, unsigned *sm_idx_p, unsigned *unit_offset_p)
 {
   tree base;
+  if (expr == error_mark_node)
+    return false;
   if (!isra_get_ref_base_and_offset (expr, &base, unit_offset_p))
     return false;
 
@@ -617,6 +619,8 @@ ipa_param_adjustments::modify_call (gcall *stmt,
 	    index = index_map[apm->base_index];
 
 	  tree arg = gimple_call_arg (stmt, index);
+	  gcc_assert (arg != error_mark_node
+		      && TREE_CODE (arg) != DEBUG_EXPR_DECL);
 
 	  vargs.quick_push (arg);
 	  kept[index] = true;
@@ -789,7 +793,14 @@ ipa_param_adjustments::modify_call (gcall *stmt,
 	  if (!is_gimple_reg (old_parm) || kept[i])
 	    continue;
 	  tree origin = DECL_ORIGIN (old_parm);
-	  tree arg = gimple_call_arg (stmt, i);
+	  int index;
+	  if (transitive_remapping)
+	    index = index_map[i];
+	  else
+	    index = i;
+	  tree arg = gimple_call_arg (stmt, index);
+	  if (arg == error_mark_node)
+	    continue;
 
 	  if (!useless_type_conversion_p (TREE_TYPE (origin), TREE_TYPE (arg)))
 	    {
@@ -1778,16 +1789,22 @@ remap_split_decl_to_dummy (tree *tp, int *walk_subtrees, void *data)
 
 /* Given ARG which is a SSA_NAME call argument which we are however removing
    from the current function and which will be thus removed from the call
-   statement by ipa_param_adjustments::modify_call, return something that can
-   be used as a placeholder and which the operand scanner will accept until
-   then.  */
+   statement by ipa_param_adjustments::modify_call.  Return either a
+   DEBUG_EXPR_DECL that describes the removed value or error_mark_node if there
+   is none.  */
 
 tree
 ipa_param_body_adjustments::get_removed_call_arg_placeholder (tree arg)
 {
-  tree t = create_tmp_var (TREE_TYPE (arg));
-  insert_decl_map (m_id, t, t);
-  return t;
+  tree *d = m_dead_ssa_debug_equiv.get (arg);
+  if (d)
+    {
+      tree t = *d;
+      insert_decl_map (m_id, t, t);
+      return t;
+    }
+  else
+    return error_mark_node;
 }
 
 /* If the call statement pointed at by STMT_P contains any expressions that
diff --git a/gcc/testsuite/gcc.dg/guality/ipa-sra-1.c b/gcc/testsuite/gcc.dg/guality/ipa-sra-1.c
index 5434b3d7665..5eaf616dd43 100644
--- a/gcc/testsuite/gcc.dg/guality/ipa-sra-1.c
+++ b/gcc/testsuite/gcc.dg/guality/ipa-sra-1.c
@@ -12,7 +12,7 @@ static int __attribute__((noinline))
 bar (int i, int k)
 {
   asm ("" : "+r" (i));
-  use (i);		/* { dg-final { gdb-test . "k" "3" { xfail *-*-* } } } */
+  use (i);		/* { dg-final { gdb-test . "k" "3" } } */
   return 6;
 }
 
diff --git a/gcc/testsuite/gcc.dg/guality/pr95343.c b/gcc/testsuite/gcc.dg/guality/pr95343.c
new file mode 100644
index 00000000000..7670eb87932
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/guality/pr95343.c
@@ -0,0 +1,45 @@
+/* { dg-do run } */
+/* { dg-options "-g -fno-ipa-icf" } */
+
+volatile int v;
+
+int __attribute__((noipa))
+get_val0 (void)  {return 0;}
+int __attribute__((noipa))
+get_val2 (void)  {return 2;}
+
+struct S
+{
+  int a, b, c;
+};
+
+static int __attribute__((noinline))
+bar (struct S s, int x, int y, int z, int i)
+{
+  int r;
+  v = s.a + s.b;		/* { dg-final { gdb-test . "i" "2" } } */
+  return r;
+}
+
+static int __attribute__((noinline))
+foo (struct S s, int i)
+{
+  int r;
+  r = bar (s, 3, 4, 5, i);
+  return r;
+}
+
+
+int
+main (void)
+{
+  struct S s;
+  int i;
+  i = get_val2 ();
+  s.a = get_val0 ();
+  s.b = get_val0 ();
+  s.c = get_val0 ();
+  int r = foo (s, i);
+  v = r + i;
+  return 0;
+}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index d06a479e570..d96fee5bb7f 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3433,10 +3433,18 @@ verify_gimple_call (gcall *stmt)
   for (i = 0; i < gimple_call_num_args (stmt); ++i)
     {
       tree arg = gimple_call_arg (stmt, i);
-      if ((is_gimple_reg_type (TREE_TYPE (arg))
+      if (((is_gimple_reg_type (TREE_TYPE (arg))
 	   && !is_gimple_val (arg))
-	  || (!is_gimple_reg_type (TREE_TYPE (arg))
-	      && !is_gimple_lvalue (arg)))
+	   || (!is_gimple_reg_type (TREE_TYPE (arg))
+	       && !is_gimple_lvalue (arg)))
+	  /* DEBUG_EXPR_DECL or error_mark_mode can occur in call statements
+	     for a brief moment when a function clone has been materialized but
+	     call statements have not been updated yet and unused arguments not
+	     removed.  */
+	  && ((TREE_CODE (arg) != DEBUG_EXPR_DECL
+	       && arg != error_mark_node)
+	      || (current_pass->type != SIMPLE_IPA_PASS
+		  && current_pass->type != IPA_PASS)))
 	{
 	  error ("invalid argument to gimple call");
 	  debug_generic_expr (arg);
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index f4716d0e36f..4d235af898e 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "stmt.h"
 #include "print-tree.h"
 #include "dumpfile.h"
-
+#include "tree-pass.h"
 
 /* This file contains the code required to manage the operands cache of the
    SSA optimizer.  For every stmt, we maintain an operand cache in the stmt
@@ -813,9 +813,21 @@ operands_scanner::get_expr_operands (tree *expr_p, int flags)
       return;
 
     case DEBUG_EXPR_DECL:
-      gcc_assert (gimple_debug_bind_p (stmt));
+      /* DEBUG_EXPR_DECL can occur in call statements for a brief moment when a
+	 function clone has been materialized but call statements have not been
+	 updated yet and unused arguments not removed.  */
+      gcc_assert (gimple_debug_bind_p (stmt)
+		  || current_pass->type == SIMPLE_IPA_PASS
+		  || current_pass->type == IPA_PASS);
+      return;
+    case ERROR_MARK:
+      /* When not producing debug info, error_mark_node is used as a
+	 placeholder for removed arguments.  */
+      gcc_assert (current_pass->type == SIMPLE_IPA_PASS
+		  || current_pass->type == IPA_PASS);
       return;
 
+      
     case MEM_REF:
       get_mem_ref_operands (expr, flags);
       return;
