This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Optimize (void) stpcpy (s1, s2) and (void) mempcpy (s1,s2)


+      /* If return value is ignored, transform mempcpy into memcpy. */
+      if (target == const0_rtx)
+      {
+        tree fn;
+	   rtx ret = expand_builtin_memcpy (arglist, target, mode, /*endp=*/0);
+
+	  if (ret)
+	      return ret;
+
+	  fn = implicit_built_in_decls[BUILT_IN_MEMCPY];
+	    if (!fn)
+	        return 0;
+
+	  return expand_expr (build_function_call_expr (fn, arglist),
+			           target, mode, EXPAND_NORMAL);
+				   }

Jakub I'm curious.  What's the purpose of first calling
expand_builtin_memcpy, then if that fails tranform into
__builtin_memcpy?  Why not just do the latter and let the builtin do
any appropriate further optimizations?  Ditto for stpcpy->strcpy.

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]