Page MenuHomePhabricator

memcpy is not tailcalled
AcceptedPublic

Authored by ramred01 on Mar 7 2019, 1:45 AM.

Details

Reviewers
wmi
mkuper
Summary

In library routines like memcpy, memmove, memset, etc., the first argument that is passed is returned as the return value. LLVM was not able to tailcall these functions. While there was a check to see if the return value was the same as the first argument, if the return value were to be a bitcast of the first argument, this check would fail and eventually LLVM would decide not to tailcall the function.

This fix checks for the bitcast situation apart from the regular check that was being done earlier.

Diff Detail

Event Timeline

ramred01 created this revision.Mar 7 2019, 1:45 AM
ramred01 updated this revision to Diff 192592.Mar 28 2019, 3:00 AM
ramred01 edited the summary of this revision. (Show Details)

Updated the summary to properly reflect the issue and the solution.

Added a test case.

wmi accepted this revision.Apr 1 2019, 2:47 PM

LGTM.

This revision is now accepted and ready to land.Apr 1 2019, 2:47 PM