OSDN Git Service

[TailCall] Allow llvm.memcpy/memset/memmove to be tail calls when parent
authorWei Mi <wmi@google.com>
Wed, 6 Sep 2017 16:05:17 +0000 (16:05 +0000)
committerWei Mi <wmi@google.com>
Wed, 6 Sep 2017 16:05:17 +0000 (16:05 +0000)
commit78696b31cd5f23c5a1aea1f85af7678505d1b259
treef90429d79c08e7025546640dba82c3b65ab85504
parent651c4efd779b6f8bd47c24863e2909b6f7bce07d
[TailCall] Allow llvm.memcpy/memset/memmove to be tail calls when parent
function return the intrinsics's first argument.

llvm.memcpy/memset/memmove return void but they will return the first
argument after they are expanded as libcalls. Now if the parent function
has any return value, llvm.memcpy cannot be turned into tail call after
expansion.

The patch is to handle that case in SelectionDAGBuilder so when caller
function return the same value as the first argument of llvm.memcpy,
tail call is allowed.

Differential Revision: https://reviews.llvm.org/D37406

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312641 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/Analysis.cpp
test/CodeGen/X86/tailcall-mem-intrinsics.ll