Index: tree.c
===================================================================
--- tree.c	(revision 161471)
+++ tree.c	(working copy)
@@ -7303,6 +7303,13 @@ build_function_decl_skip_args (tree orig
      we expect first argument to be THIS pointer.   */
   if (bitmap_bit_p (args_to_skip, 0))
     DECL_VINDEX (new_decl) = NULL_TREE;
+
+  /* When signature changes, we need to clear builtin info.  */
+  if (DECL_BUILT_IN (new_decl) && !bitmap_empty_p (args_to_skip))
+    {
+      DECL_BUILT_IN_CLASS (new_decl) = NOT_BUILT_IN;
+      DECL_FUNCTION_CODE (new_decl) = (enum built_in_function) 0;
+    }
   return new_decl;
 }
 
Index: ipa-split.c
===================================================================
--- ipa-split.c	(revision 161472)
+++ ipa-split.c	(working copy)
@@ -843,6 +843,14 @@ split_function (struct split_point *spli
 				     args_to_skip,
 				     split_point->split_bbs,
 				     split_point->entry_bb, "_part");
+  /* For usual clonning it is enough to clear builtin only when signature
+     changes.  For partial inlining we however can not expect the part
+     of builtin implementation to have same semantic as the whole.  */
+  if (DECL_BUILT_IN (node->decl))
+    {
+      DECL_BUILT_IN_CLASS (node->decl) = NOT_BUILT_IN;
+      DECL_FUNCTION_CODE (node->decl) = (enum built_in_function) 0;
+    }
   cgraph_node_remove_callees (cgraph_node (current_function_decl));
   if (!split_part_return_p)
     TREE_THIS_VOLATILE (node->decl) = 1;
Index: ipa-prop.c
===================================================================
--- ipa-prop.c	(revision 161471)
+++ ipa-prop.c	(working copy)
@@ -2087,6 +2087,13 @@ ipa_modify_formal_parameters (tree fndec
       DECL_VINDEX (fndecl) = NULL_TREE;
     }
 
+  /* When signature changes, we need to clear builtin info.  */
+  if (DECL_BUILT_IN (fndecl) && !bitmap_empty_p (args_to_skip))
+    {
+      DECL_BUILT_IN_CLASS (fndecl) = NOT_BUILT_IN;
+      DECL_FUNCTION_CODE (fndecl) = (enum built_in_function) 0;
+    }
+
   /* This is a new type, not a copy of an old type.  Need to reassociate
      variants.  We can handle everything except the main variant lazily.  */
   t = TYPE_MAIN_VARIANT (orig_type);
