[PATCH] D37406: [TailCall] Allow llvm.memcpy/memset/memmove to be tail calls when parent function return the intrinsics's first argument

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 7 12:34:10 PDT 2017


efriedma added inline comments.


================
Comment at: llvm/trunk/lib/CodeGen/Analysis.cpp:569
+  // Intrinsic like llvm.memcpy has no return value, but will return the
+  // first argument if it is expanded as libcall.
+  const CallInst *Call = cast<CallInst>(I);
----------------
This is only true if the argument is specifically expanded to a libcall to the C library function "memcpy".  If the target expands it to some other library call (e.g., __aeabi_memcpy, like we do on Android), it isn't a tail call, and we miscompile.


Repository:
  rL LLVM

https://reviews.llvm.org/D37406





More information about the llvm-commits mailing list