[TargetLibraryInfo] memcpy and memset have optimized codegen.
authorClement Courbet <courbet@google.com>
Mon, 27 Apr 2020 08:45:41 +0000 (10:45 +0200)
committerClement Courbet <courbet@google.com>
Mon, 18 May 2020 06:49:23 +0000 (08:49 +0200)
Summary:
Add memcpy and memset to the list of function with optimized codegen.
hasOptimizedCodeGen() was returning false for them.
This was not an issue when working with c++ as clang typically emits an
intrinsic rather than a libfunc call, but when working with IR,
this would cause some issues with sanitizers which would not correctly
mark the function as nobuiltin in `maybeMarkSanitizerLibraryCallNoBuiltin()`.

Subscribers: llvm-commits

Tags: #llvm

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

llvm/include/llvm/Analysis/TargetLibraryInfo.h

index 4270480..0b57e95 100644 (file)
@@ -350,6 +350,7 @@ public:
     case LibFunc_trunc:        case LibFunc_truncf:     case LibFunc_truncl:
     case LibFunc_log2:         case LibFunc_log2f:      case LibFunc_log2l:
     case LibFunc_exp2:         case LibFunc_exp2f:      case LibFunc_exp2l:
+    case LibFunc_memcpy:       case LibFunc_memset:     case LibFunc_memmove:
     case LibFunc_memcmp:       case LibFunc_bcmp:       case LibFunc_strcmp:
     case LibFunc_strcpy:       case LibFunc_stpcpy:     case LibFunc_strlen:
     case LibFunc_strnlen:      case LibFunc_memchr:     case LibFunc_mempcpy: