[PATCH] D91677: Avoid transforming fortified bcopy to memmove

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 17 23:51:31 PST 2020


serge-sans-paille added a comment.

> ! In D91677#2401785 <https://reviews.llvm.org/D91677#2401785>, @siddhesh wrote:
>  Maybe because that D71082 <https://reviews.llvm.org/D71082> is limited to clang?  The bcopy survives clang but llvm forces it into a memmove without this patch.

ok, got it. `bcopy` is somehow special here, because it doesn't have an associated llvm builtin like `memcpy` has.

> Would you like to see this change be more generic, i.e. for any libcall, if the callee has a function body that has a call instruction in its first BB, avoid optimizing it?

I'd go even further: if the callee has a function body and is known has a library function, then don't optimize it because there's a provided implementation. I don't think the requirement of a call instruction in the body should be mandatory: the fortified version could provide, say, an inlined implementation ? Or maybe some setup code before calling the `_chk` version?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91677/new/

https://reviews.llvm.org/D91677



More information about the llvm-commits mailing list