[llvm] 0dcfe7a - [InstCombine] Tighten up known library function signature tests (PR #56463)

Martin Sebor via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 13:43:41 PDT 2022


Author: Martin Sebor
Date: 2022-08-10T14:15:46-06:00
New Revision: 0dcfe7aa35cd4f6dbeb739fcd05f93aa39394f0e

URL: https://github.com/llvm/llvm-project/commit/0dcfe7aa35cd4f6dbeb739fcd05f93aa39394f0e
DIFF: https://github.com/llvm/llvm-project/commit/0dcfe7aa35cd4f6dbeb739fcd05f93aa39394f0e.diff

LOG: [InstCombine] Tighten up known library function signature tests (PR #56463)

Replace a switch statement used to validate arguments to known library
functions with a more consistent table-driven approach and tighten it
up.

Added: 
    llvm/test/Transforms/InferFunctionAttrs/annotate-2.ll
    llvm/test/Transforms/InstCombine/new-delete-itanium-32.ll
    llvm/test/Transforms/InstCombine/simplify-libcalls-i16.ll
    llvm/test/Transforms/InstCombine/sprintf-3.ll
    llvm/test/Transforms/InstCombine/stdiocall-bad-sig.ll
    llvm/test/Transforms/InstCombine/strcall-bad-sig.ll

Modified: 
    llvm/include/llvm/Analysis/TargetLibraryInfo.def
    llvm/lib/Analysis/TargetLibraryInfo.cpp
    llvm/test/CodeGen/AMDGPU/complex-folding.ll
    llvm/test/CodeGen/AMDGPU/fabs.ll
    llvm/test/CodeGen/AMDGPU/floor.ll
    llvm/test/CodeGen/AMDGPU/fneg-fabs.ll
    llvm/test/CodeGen/AMDGPU/r600-infinite-loop-bug-while-reorganizing-vector.ll
    llvm/test/CodeGen/AMDGPU/schedule-if-2.ll
    llvm/test/Transforms/DeadStoreElimination/simple.ll
    llvm/test/Transforms/InferFunctionAttrs/annotate.ll
    llvm/test/Transforms/InstCombine/bcopy.ll
    llvm/test/Transforms/InstCombine/deref-alloc-fns.ll
    llvm/test/Transforms/InstCombine/fprintf-1.ll
    llvm/test/Transforms/InstCombine/fwrite-1.ll
    llvm/test/Transforms/InstCombine/mem-deref-bytes-addrspaces.ll
    llvm/test/Transforms/InstCombine/mem-deref-bytes.ll
    llvm/test/Transforms/InstCombine/new-delete-itanium.ll
    llvm/test/Transforms/InstCombine/printf-2.ll
    llvm/test/Transforms/InstCombine/simplify-libcalls.ll
    llvm/test/Transforms/InstCombine/sqrt-nofast.ll
    llvm/test/Transforms/InstCombine/stpcpy-1.ll
    llvm/test/Transforms/InstCombine/stpcpy-2.ll
    llvm/test/Transforms/InstCombine/stpcpy_chk-2.ll
    llvm/test/Transforms/InstCombine/str-int.ll
    llvm/test/Transforms/InstCombine/strcat-3.ll
    llvm/test/Transforms/InstCombine/strcpy-2.ll
    llvm/test/Transforms/InstCombine/strcpy_chk-2.ll
    llvm/test/Transforms/InstCombine/strncat-3.ll
    llvm/test/Transforms/InstCombine/strncpy-2.ll
    llvm/test/Transforms/InstCombine/strncpy_chk-2.ll
    llvm/test/Transforms/InstCombine/strndup.ll
    llvm/test/Transforms/InstCombine/strpbrk-2.ll
    llvm/test/Transforms/InstCombine/strspn-1.ll
    llvm/test/Transforms/InstCombine/strto-1.ll
    llvm/test/Transforms/InstSimplify/call.ll
    llvm/test/Transforms/LoopUnroll/WebAssembly/basic-unrolling.ll
    llvm/test/Transforms/LoopVectorize/AArch64/extractvalue-no-scalarization-required.ll
    llvm/unittests/Analysis/TargetLibraryInfoTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
index 9c1abef33b288..3602e9183301d 100644
--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.def
+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
@@ -20,1461 +20,2385 @@
 // When adding a LibFunc which reallocates memory include the LibFunc
 // in lib/Analysis/MemoryBuiltins.cpp "AllocationFnData[]".
 
-#if !(defined(TLI_DEFINE_ENUM) || defined(TLI_DEFINE_STRING))
-#error "Must define TLI_DEFINE_ENUM or TLI_DEFINE_STRING for TLI .def."
-#elif defined(TLI_DEFINE_ENUM) && defined(TLI_DEFINE_STRING)
-#error "Can only define one of TLI_DEFINE_ENUM or TLI_DEFINE_STRING at a time."
+#if (defined(TLI_DEFINE_ENUM) +                 \
+     defined(TLI_DEFINE_STRING) +               \
+     defined(TLI_DEFINE_SIG) != 1)
+#error "Must define exactly one of TLI_DEFINE_ENUM, TLI_DEFINE_STRING, or TLI_DEFINE_SIG for TLI .def."
 #else
-// One of TLI_DEFINE_ENUM/STRING are defined.
+// Exactly one of TLI_DEFINE_ENUM/STRING/SIG is defined.
 
 #if defined(TLI_DEFINE_ENUM)
 #define TLI_DEFINE_ENUM_INTERNAL(enum_variant) LibFunc_##enum_variant,
 #define TLI_DEFINE_STRING_INTERNAL(string_repr)
-#else
+#define TLI_DEFINE_SIG_INTERNAL(...)
+#elif defined(TLI_DEFINE_STRING)
 #define TLI_DEFINE_ENUM_INTERNAL(enum_variant)
 #define TLI_DEFINE_STRING_INTERNAL(string_repr) string_repr,
+#define TLI_DEFINE_SIG_INTERNAL(...)
+#else
+#define TLI_DEFINE_ENUM_INTERNAL(enum_variant)
+#define TLI_DEFINE_STRING_INTERNAL(string_repr)
+#define TLI_DEFINE_SIG_INTERNAL(...) { __VA_ARGS__ },
 #endif
 
-/// void *new(unsigned int);
+/// void *operator new(unsigned int);
 TLI_DEFINE_ENUM_INTERNAL(msvc_new_int)
 TLI_DEFINE_STRING_INTERNAL("??2 at YAPAXI@Z")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Int)
 
-/// void *new(unsigned int, nothrow);
+/// void *operator new(unsigned int, const std::nothrow_t&);
 TLI_DEFINE_ENUM_INTERNAL(msvc_new_int_nothrow)
 TLI_DEFINE_STRING_INTERNAL("??2 at YAPAXIABUnothrow_t@std@@@Z")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Int, Ptr)
 
-/// void *new(unsigned long long);
+/// void *operator new(unsigned long long);
 TLI_DEFINE_ENUM_INTERNAL(msvc_new_longlong)
 TLI_DEFINE_STRING_INTERNAL("??2 at YAPEAX_K@Z")
+TLI_DEFINE_SIG_INTERNAL(Ptr, LLong)
 
-/// void *new(unsigned long long, nothrow);
+/// void *operator new(unsigned long long, const std::nothrow_t&);
 TLI_DEFINE_ENUM_INTERNAL(msvc_new_longlong_nothrow)
 TLI_DEFINE_STRING_INTERNAL("??2 at YAPEAX_KAEBUnothrow_t@std@@@Z")
+TLI_DEFINE_SIG_INTERNAL(Ptr, LLong, Ptr)
 
 /// void operator delete(void*);
 TLI_DEFINE_ENUM_INTERNAL(msvc_delete_ptr32)
 TLI_DEFINE_STRING_INTERNAL("??3 at YAXPAX@Z")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr)
 
-/// void operator delete(void*, nothrow);
+/// void operator delete(void*, const std::nothrow_t&);
 TLI_DEFINE_ENUM_INTERNAL(msvc_delete_ptr32_nothrow)
 TLI_DEFINE_STRING_INTERNAL("??3 at YAXPAXABUnothrow_t@std@@@Z")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Ptr)
 
 /// void operator delete(void*, unsigned int);
 TLI_DEFINE_ENUM_INTERNAL(msvc_delete_ptr32_int)
 TLI_DEFINE_STRING_INTERNAL("??3 at YAXPAXI@Z")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Int)
 
 /// void operator delete(void*);
 TLI_DEFINE_ENUM_INTERNAL(msvc_delete_ptr64)
 TLI_DEFINE_STRING_INTERNAL("??3 at YAXPEAX@Z")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr)
 
-/// void operator delete(void*, nothrow);
+/// void operator delete(void*, const std::nothrow_t&);
 TLI_DEFINE_ENUM_INTERNAL(msvc_delete_ptr64_nothrow)
 TLI_DEFINE_STRING_INTERNAL("??3 at YAXPEAXAEBUnothrow_t@std@@@Z")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Ptr)
 
 /// void operator delete(void*, unsigned long long);
 TLI_DEFINE_ENUM_INTERNAL(msvc_delete_ptr64_longlong)
 TLI_DEFINE_STRING_INTERNAL("??3 at YAXPEAX_K@Z")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, LLong)
 
-/// void *new[](unsigned int);
+/// void *operator new[](unsigned int);
 TLI_DEFINE_ENUM_INTERNAL(msvc_new_array_int)
 TLI_DEFINE_STRING_INTERNAL("??_U at YAPAXI@Z")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Int)
 
-/// void *new[](unsigned int, nothrow);
+/// void *operator new[](unsigned int, const std::nothrow_t&);
 TLI_DEFINE_ENUM_INTERNAL(msvc_new_array_int_nothrow)
 TLI_DEFINE_STRING_INTERNAL("??_U at YAPAXIABUnothrow_t@std@@@Z")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Int, Ptr)
 
-/// void *new[](unsigned long long);
+/// void *operator new[](unsigned long long);
 TLI_DEFINE_ENUM_INTERNAL(msvc_new_array_longlong)
 TLI_DEFINE_STRING_INTERNAL("??_U at YAPEAX_K@Z")
+TLI_DEFINE_SIG_INTERNAL(Ptr, LLong)
 
-/// void *new[](unsigned long long, nothrow);
+/// void *operator new[](unsigned long long, const std::nothrow_t&);
 TLI_DEFINE_ENUM_INTERNAL(msvc_new_array_longlong_nothrow)
 TLI_DEFINE_STRING_INTERNAL("??_U at YAPEAX_KAEBUnothrow_t@std@@@Z")
+TLI_DEFINE_SIG_INTERNAL(Ptr, LLong, Ptr)
 
 /// void operator delete[](void*);
 TLI_DEFINE_ENUM_INTERNAL(msvc_delete_array_ptr32)
 TLI_DEFINE_STRING_INTERNAL("??_V at YAXPAX@Z")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr)
 
-/// void operator delete[](void*, nothrow);
+/// void operator delete[](void*, const std::nothrow_t&);
 TLI_DEFINE_ENUM_INTERNAL(msvc_delete_array_ptr32_nothrow)
 TLI_DEFINE_STRING_INTERNAL("??_V at YAXPAXABUnothrow_t@std@@@Z")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Ptr)
 
 /// void operator delete[](void*, unsigned int);
 TLI_DEFINE_ENUM_INTERNAL(msvc_delete_array_ptr32_int)
 TLI_DEFINE_STRING_INTERNAL("??_V at YAXPAXI@Z")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Int)
 
 /// void operator delete[](void*);
 TLI_DEFINE_ENUM_INTERNAL(msvc_delete_array_ptr64)
 TLI_DEFINE_STRING_INTERNAL("??_V at YAXPEAX@Z")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr)
 
-/// void operator delete[](void*, nothrow);
+/// void operator delete[](void*, const std::nothrow_t&);
 TLI_DEFINE_ENUM_INTERNAL(msvc_delete_array_ptr64_nothrow)
 TLI_DEFINE_STRING_INTERNAL("??_V at YAXPEAXAEBUnothrow_t@std@@@Z")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Ptr)
 
 /// void operator delete[](void*, unsigned long long);
 TLI_DEFINE_ENUM_INTERNAL(msvc_delete_array_ptr64_longlong)
 TLI_DEFINE_STRING_INTERNAL("??_V at YAXPEAX_K@Z")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, LLong)
 
 /// int _IO_getc(_IO_FILE * __fp);
 TLI_DEFINE_ENUM_INTERNAL(under_IO_getc)
 TLI_DEFINE_STRING_INTERNAL("_IO_getc")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// int _IO_putc(int __c, _IO_FILE * __fp);
 TLI_DEFINE_ENUM_INTERNAL(under_IO_putc)
 TLI_DEFINE_STRING_INTERNAL("_IO_putc")
+TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
+
 /// void operator delete[](void*);
 TLI_DEFINE_ENUM_INTERNAL(ZdaPv)
 TLI_DEFINE_STRING_INTERNAL("_ZdaPv")
-/// void operator delete[](void*, nothrow);
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr)
+
+/// void operator delete[](void*, const std::nothrow_t&);
 TLI_DEFINE_ENUM_INTERNAL(ZdaPvRKSt9nothrow_t)
 TLI_DEFINE_STRING_INTERNAL("_ZdaPvRKSt9nothrow_t")
-/// void operator delete[](void*, align_val_t);
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Ptr)
+
+/// void operator delete[](void*, std::align_val_t);
 TLI_DEFINE_ENUM_INTERNAL(ZdaPvSt11align_val_t)
 TLI_DEFINE_STRING_INTERNAL("_ZdaPvSt11align_val_t")
-/// void operator delete[](void*, align_val_t, nothrow)
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, IntPlus)
+
+/// void operator delete[](void*, std::align_val_t, const std::nothrow_t&)
 TLI_DEFINE_ENUM_INTERNAL(ZdaPvSt11align_val_tRKSt9nothrow_t)
 TLI_DEFINE_STRING_INTERNAL("_ZdaPvSt11align_val_tRKSt9nothrow_t")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, IntPlus, Ptr)
+
 /// void operator delete[](void*, unsigned int);
 TLI_DEFINE_ENUM_INTERNAL(ZdaPvj)
 TLI_DEFINE_STRING_INTERNAL("_ZdaPvj")
-/// void operator delete[](void*, unsigned int, align_val_t);
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Int)
+
+/// void operator delete[](void*, unsigned int, std::align_val_t);
 TLI_DEFINE_ENUM_INTERNAL(ZdaPvjSt11align_val_t)
 TLI_DEFINE_STRING_INTERNAL("_ZdaPvjSt11align_val_t")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Int, Int)
+
 /// void operator delete[](void*, unsigned long);
 TLI_DEFINE_ENUM_INTERNAL(ZdaPvm)
 TLI_DEFINE_STRING_INTERNAL("_ZdaPvm")
-/// void operator delete[](void*, unsigned long, align_val_t);
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Long)
+
+/// void operator delete[](void*, unsigned long, std::align_val_t);
 TLI_DEFINE_ENUM_INTERNAL(ZdaPvmSt11align_val_t)
 TLI_DEFINE_STRING_INTERNAL("_ZdaPvmSt11align_val_t")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Long, Long)
+
 /// void operator delete(void*);
 TLI_DEFINE_ENUM_INTERNAL(ZdlPv)
 TLI_DEFINE_STRING_INTERNAL("_ZdlPv")
-/// void operator delete(void*, nothrow);
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr)
+
+/// void operator delete(void*, const std::nothrow_t&);
 TLI_DEFINE_ENUM_INTERNAL(ZdlPvRKSt9nothrow_t)
 TLI_DEFINE_STRING_INTERNAL("_ZdlPvRKSt9nothrow_t")
-/// void operator delete(void*, align_val_t)
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Ptr)
+
+/// void operator delete(void*, std::align_val_t)
 TLI_DEFINE_ENUM_INTERNAL(ZdlPvSt11align_val_t)
 TLI_DEFINE_STRING_INTERNAL("_ZdlPvSt11align_val_t")
-/// void operator delete(void*, align_val_t, nothrow)
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, IntPlus)
+
+/// void operator delete(void*, std::align_val_t, const std::nothrow_t&)
 TLI_DEFINE_ENUM_INTERNAL(ZdlPvSt11align_val_tRKSt9nothrow_t)
 TLI_DEFINE_STRING_INTERNAL("_ZdlPvSt11align_val_tRKSt9nothrow_t")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, IntPlus, Ptr)
+
 /// void operator delete(void*, unsigned int);
 TLI_DEFINE_ENUM_INTERNAL(ZdlPvj)
 TLI_DEFINE_STRING_INTERNAL("_ZdlPvj")
-/// void operator delete(void*, unsigned int, align_val_t)
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Int)
+
+/// void operator delete(void*, unsigned int, std::align_val_t)
 TLI_DEFINE_ENUM_INTERNAL(ZdlPvjSt11align_val_t)
 TLI_DEFINE_STRING_INTERNAL("_ZdlPvjSt11align_val_t")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Int, Int)
+
 /// void operator delete(void*, unsigned long);
 TLI_DEFINE_ENUM_INTERNAL(ZdlPvm)
 TLI_DEFINE_STRING_INTERNAL("_ZdlPvm")
-/// void operator delete(void*, unsigned long, align_val_t)
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Long)
+
+/// void operator delete(void*, unsigned long, std::align_val_t)
 TLI_DEFINE_ENUM_INTERNAL(ZdlPvmSt11align_val_t)
 TLI_DEFINE_STRING_INTERNAL("_ZdlPvmSt11align_val_t")
-/// void *new[](unsigned int);
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Long, Long)
+
+/// void *operator new[](unsigned int);
 TLI_DEFINE_ENUM_INTERNAL(Znaj)
 TLI_DEFINE_STRING_INTERNAL("_Znaj")
-/// void *new[](unsigned int, nothrow);
+TLI_DEFINE_SIG_INTERNAL(Ptr, Int)
+
+/// void *operator new[](unsigned int, const std::nothrow_t&);
 TLI_DEFINE_ENUM_INTERNAL(ZnajRKSt9nothrow_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnajRKSt9nothrow_t")
-/// void *new[](unsigned int, align_val_t)
+TLI_DEFINE_SIG_INTERNAL(Ptr, Int, Ptr)
+
+/// void *operator new[](unsigned int, std::align_val_t)
 TLI_DEFINE_ENUM_INTERNAL(ZnajSt11align_val_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnajSt11align_val_t")
-/// void *new[](unsigned int, align_val_t, nothrow)
+TLI_DEFINE_SIG_INTERNAL(Ptr, Int, Int)
+
+/// void *operator new[](unsigned int, std::align_val_t, const std::nothrow_t&)
 TLI_DEFINE_ENUM_INTERNAL(ZnajSt11align_val_tRKSt9nothrow_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnajSt11align_val_tRKSt9nothrow_t")
-/// void *new[](unsigned long);
+TLI_DEFINE_SIG_INTERNAL(Ptr, Int, Int, Ptr)
+
+/// void *operator new[](unsigned long);
 TLI_DEFINE_ENUM_INTERNAL(Znam)
 TLI_DEFINE_STRING_INTERNAL("_Znam")
-/// void *new[](unsigned long, nothrow);
+TLI_DEFINE_SIG_INTERNAL(Ptr, Long)
+
+/// void *operator new[](unsigned long, const std::nothrow_t&);
 TLI_DEFINE_ENUM_INTERNAL(ZnamRKSt9nothrow_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnamRKSt9nothrow_t")
-/// void *new[](unsigned long, align_val_t)
+TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Ptr)
+
+/// void *operator new[](unsigned long, std::align_val_t)
 TLI_DEFINE_ENUM_INTERNAL(ZnamSt11align_val_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnamSt11align_val_t")
-/// void *new[](unsigned long, align_val_t, nothrow)
+TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Long)
+
+/// void *operator new[](unsigned long, std::align_val_t, const std::nothrow_t&)
 TLI_DEFINE_ENUM_INTERNAL(ZnamSt11align_val_tRKSt9nothrow_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnamSt11align_val_tRKSt9nothrow_t")
-/// void *new(unsigned int);
+TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Long, Ptr)
+
+/// void *operator new(unsigned int);
 TLI_DEFINE_ENUM_INTERNAL(Znwj)
 TLI_DEFINE_STRING_INTERNAL("_Znwj")
-/// void *new(unsigned int, nothrow);
+TLI_DEFINE_SIG_INTERNAL(Ptr, Int)
+
+/// void *operator new(unsigned int, const std::nothrow_t&);
 TLI_DEFINE_ENUM_INTERNAL(ZnwjRKSt9nothrow_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnwjRKSt9nothrow_t")
-/// void *new(unsigned int, align_val_t)
+TLI_DEFINE_SIG_INTERNAL(Ptr, Int, Ptr)
+
+/// void *operator new(unsigned int, std::align_val_t)
 TLI_DEFINE_ENUM_INTERNAL(ZnwjSt11align_val_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnwjSt11align_val_t")
-/// void *new(unsigned int, align_val_t, nothrow)
+TLI_DEFINE_SIG_INTERNAL(Ptr, Int, Int)
+
+/// void *operator new(unsigned int, std::align_val_t, const std::nothrow_t&)
 TLI_DEFINE_ENUM_INTERNAL(ZnwjSt11align_val_tRKSt9nothrow_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnwjSt11align_val_tRKSt9nothrow_t")
-/// void *new(unsigned long);
+TLI_DEFINE_SIG_INTERNAL(Ptr, Int, Int, Ptr)
+
+/// void *operator new(unsigned long);
 TLI_DEFINE_ENUM_INTERNAL(Znwm)
 TLI_DEFINE_STRING_INTERNAL("_Znwm")
-/// void *new(unsigned long, nothrow);
+TLI_DEFINE_SIG_INTERNAL(Ptr, Long)
+
+/// void *operator new(unsigned long, const std::nothrow_t&);
 TLI_DEFINE_ENUM_INTERNAL(ZnwmRKSt9nothrow_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnwmRKSt9nothrow_t")
-/// void *new(unsigned long, align_val_t)
+TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Ptr)
+
+/// void *operator new(unsigned long, std::align_val_t)
 TLI_DEFINE_ENUM_INTERNAL(ZnwmSt11align_val_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnwmSt11align_val_t")
-/// void *new(unsigned long, align_val_t, nothrow)
+TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Long)
+
+/// void *operator new(unsigned long, std::align_val_t, const std::nothrow_t&)
 TLI_DEFINE_ENUM_INTERNAL(ZnwmSt11align_val_tRKSt9nothrow_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnwmSt11align_val_tRKSt9nothrow_t")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Long, Ptr)
+
 /// double __acos_finite(double x);
 TLI_DEFINE_ENUM_INTERNAL(acos_finite)
 TLI_DEFINE_STRING_INTERNAL("__acos_finite")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float __acosf_finite(float x);
 TLI_DEFINE_ENUM_INTERNAL(acosf_finite)
 TLI_DEFINE_STRING_INTERNAL("__acosf_finite")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// double __acosh_finite(double x);
 TLI_DEFINE_ENUM_INTERNAL(acosh_finite)
 TLI_DEFINE_STRING_INTERNAL("__acosh_finite")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float __acoshf_finite(float x);
 TLI_DEFINE_ENUM_INTERNAL(acoshf_finite)
 TLI_DEFINE_STRING_INTERNAL("__acoshf_finite")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double __acoshl_finite(long double x);
 TLI_DEFINE_ENUM_INTERNAL(acoshl_finite)
 TLI_DEFINE_STRING_INTERNAL("__acoshl_finite")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// long double __acosl_finite(long double x);
 TLI_DEFINE_ENUM_INTERNAL(acosl_finite)
 TLI_DEFINE_STRING_INTERNAL("__acosl_finite")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double __asin_finite(double x);
 TLI_DEFINE_ENUM_INTERNAL(asin_finite)
 TLI_DEFINE_STRING_INTERNAL("__asin_finite")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float __asinf_finite(float x);
 TLI_DEFINE_ENUM_INTERNAL(asinf_finite)
 TLI_DEFINE_STRING_INTERNAL("__asinf_finite")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double __asinl_finite(long double x);
 TLI_DEFINE_ENUM_INTERNAL(asinl_finite)
 TLI_DEFINE_STRING_INTERNAL("__asinl_finite")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double atan2_finite(double y, double x);
 TLI_DEFINE_ENUM_INTERNAL(atan2_finite)
 TLI_DEFINE_STRING_INTERNAL("__atan2_finite")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl, Dbl)
+
 /// float atan2f_finite(float y, float x);
 TLI_DEFINE_ENUM_INTERNAL(atan2f_finite)
 TLI_DEFINE_STRING_INTERNAL("__atan2f_finite")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt, Flt)
+
 /// long double atan2l_finite(long double y, long double x);
 TLI_DEFINE_ENUM_INTERNAL(atan2l_finite)
 TLI_DEFINE_STRING_INTERNAL("__atan2l_finite")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl, LDbl)
+
 /// double __atanh_finite(double x);
 TLI_DEFINE_ENUM_INTERNAL(atanh_finite)
 TLI_DEFINE_STRING_INTERNAL("__atanh_finite")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float __atanhf_finite(float x);
 TLI_DEFINE_ENUM_INTERNAL(atanhf_finite)
 TLI_DEFINE_STRING_INTERNAL("__atanhf_finite")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double __atanhl_finite(long double x);
 TLI_DEFINE_ENUM_INTERNAL(atanhl_finite)
 TLI_DEFINE_STRING_INTERNAL("__atanhl_finite")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// void __atomic_load(size_t size, void *mptr, void *vptr, int smodel);
 TLI_DEFINE_ENUM_INTERNAL(atomic_load)
 TLI_DEFINE_STRING_INTERNAL("__atomic_load")
+TLI_DEFINE_SIG_INTERNAL(Void, SizeT, Ptr, Ptr, Int)
+
 /// void __atomic_store(size_t size, void *mptr, void *vptr, int smodel);
 TLI_DEFINE_ENUM_INTERNAL(atomic_store)
 TLI_DEFINE_STRING_INTERNAL("__atomic_store")
+TLI_DEFINE_SIG_INTERNAL(Void, SizeT, Ptr, Ptr, Int)
+
 /// double __cosh_finite(double x);
 TLI_DEFINE_ENUM_INTERNAL(cosh_finite)
 TLI_DEFINE_STRING_INTERNAL("__cosh_finite")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float __coshf_finite(float x);
 TLI_DEFINE_ENUM_INTERNAL(coshf_finite)
 TLI_DEFINE_STRING_INTERNAL("__coshf_finite")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double __coshl_finite(long double x);
 TLI_DEFINE_ENUM_INTERNAL(coshl_finite)
 TLI_DEFINE_STRING_INTERNAL("__coshl_finite")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double __cospi(double x);
 TLI_DEFINE_ENUM_INTERNAL(cospi)
 TLI_DEFINE_STRING_INTERNAL("__cospi")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float __cospif(float x);
 TLI_DEFINE_ENUM_INTERNAL(cospif)
 TLI_DEFINE_STRING_INTERNAL("__cospif")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// int __cxa_atexit(void (*f)(void *), void *p, void *d);
 TLI_DEFINE_ENUM_INTERNAL(cxa_atexit)
 TLI_DEFINE_STRING_INTERNAL("__cxa_atexit")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ptr)
+
 /// void __cxa_guard_abort(guard_t *guard);
 /// guard_t is int64_t in Itanium ABI or int32_t on ARM eabi.
 TLI_DEFINE_ENUM_INTERNAL(cxa_guard_abort)
 TLI_DEFINE_STRING_INTERNAL("__cxa_guard_abort")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr)
+
 /// int __cxa_guard_acquire(guard_t *guard);
 TLI_DEFINE_ENUM_INTERNAL(cxa_guard_acquire)
 TLI_DEFINE_STRING_INTERNAL("__cxa_guard_acquire")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// void __cxa_guard_release(guard_t *guard);
 TLI_DEFINE_ENUM_INTERNAL(cxa_guard_release)
 TLI_DEFINE_STRING_INTERNAL("__cxa_guard_release")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr)
+
 /// double __exp10_finite(double x);
 TLI_DEFINE_ENUM_INTERNAL(exp10_finite)
 TLI_DEFINE_STRING_INTERNAL("__exp10_finite")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float __exp10f_finite(float x);
 TLI_DEFINE_ENUM_INTERNAL(exp10f_finite)
 TLI_DEFINE_STRING_INTERNAL("__exp10f_finite")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double __exp10l_finite(long double x);
 TLI_DEFINE_ENUM_INTERNAL(exp10l_finite)
 TLI_DEFINE_STRING_INTERNAL("__exp10l_finite")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double __exp2_finite(double x);
 TLI_DEFINE_ENUM_INTERNAL(exp2_finite)
 TLI_DEFINE_STRING_INTERNAL("__exp2_finite")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float __exp2f_finite(float x);
 TLI_DEFINE_ENUM_INTERNAL(exp2f_finite)
 TLI_DEFINE_STRING_INTERNAL("__exp2f_finite")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double __exp2l_finite(long double x);
 TLI_DEFINE_ENUM_INTERNAL(exp2l_finite)
 TLI_DEFINE_STRING_INTERNAL("__exp2l_finite")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double __exp_finite(double x);
 TLI_DEFINE_ENUM_INTERNAL(exp_finite)
 TLI_DEFINE_STRING_INTERNAL("__exp_finite")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float __expf_finite(float x);
 TLI_DEFINE_ENUM_INTERNAL(expf_finite)
 TLI_DEFINE_STRING_INTERNAL("__expf_finite")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double __expl_finite(long double x);
 TLI_DEFINE_ENUM_INTERNAL(expl_finite)
 TLI_DEFINE_STRING_INTERNAL("__expl_finite")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// int __isoc99_scanf (const char *format, ...)
 TLI_DEFINE_ENUM_INTERNAL(dunder_isoc99_scanf)
 TLI_DEFINE_STRING_INTERNAL("__isoc99_scanf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ellip)
+
 /// int __isoc99_sscanf(const char *s, const char *format, ...)
 TLI_DEFINE_ENUM_INTERNAL(dunder_isoc99_sscanf)
 TLI_DEFINE_STRING_INTERNAL("__isoc99_sscanf")
-/// void __kmpc_alloc_shared(size_t nbyte);
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ellip)
+
+/// void* __kmpc_alloc_shared(size_t nbyte);
 TLI_DEFINE_ENUM_INTERNAL(__kmpc_alloc_shared)
 TLI_DEFINE_STRING_INTERNAL("__kmpc_alloc_shared")
+TLI_DEFINE_SIG_INTERNAL(Ptr, SizeT)
+
 /// void __kmpc_free_shared(void *ptr, size_t nbyte);
 TLI_DEFINE_ENUM_INTERNAL(__kmpc_free_shared)
 TLI_DEFINE_STRING_INTERNAL("__kmpc_free_shared")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, SizeT)
+
 /// double __log10_finite(double x);
 TLI_DEFINE_ENUM_INTERNAL(log10_finite)
 TLI_DEFINE_STRING_INTERNAL("__log10_finite")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float __log10f_finite(float x);
 TLI_DEFINE_ENUM_INTERNAL(log10f_finite)
 TLI_DEFINE_STRING_INTERNAL("__log10f_finite")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double __log10l_finite(long double x);
 TLI_DEFINE_ENUM_INTERNAL(log10l_finite)
 TLI_DEFINE_STRING_INTERNAL("__log10l_finite")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double __log2_finite(double x);
 TLI_DEFINE_ENUM_INTERNAL(log2_finite)
 TLI_DEFINE_STRING_INTERNAL("__log2_finite")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float __log2f_finite(float x);
 TLI_DEFINE_ENUM_INTERNAL(log2f_finite)
 TLI_DEFINE_STRING_INTERNAL("__log2f_finite")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double __log2l_finite(long double x);
 TLI_DEFINE_ENUM_INTERNAL(log2l_finite)
 TLI_DEFINE_STRING_INTERNAL("__log2l_finite")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double __log_finite(double x);
 TLI_DEFINE_ENUM_INTERNAL(log_finite)
 TLI_DEFINE_STRING_INTERNAL("__log_finite")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float __logf_finite(float x);
 TLI_DEFINE_ENUM_INTERNAL(logf_finite)
 TLI_DEFINE_STRING_INTERNAL("__logf_finite")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double __logl_finite(long double x);
 TLI_DEFINE_ENUM_INTERNAL(logl_finite)
 TLI_DEFINE_STRING_INTERNAL("__logl_finite")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// void *__memccpy_chk(void *dst, const void *src, int c, size_t n,
 ///                     size_t dstsize)
 TLI_DEFINE_ENUM_INTERNAL(memccpy_chk)
 TLI_DEFINE_STRING_INTERNAL("__memccpy_chk")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, Int, SizeT, SizeT)
+
 /// void *__memcpy_chk(void *s1, const void *s2, size_t n, size_t s1size);
 TLI_DEFINE_ENUM_INTERNAL(memcpy_chk)
 TLI_DEFINE_STRING_INTERNAL("__memcpy_chk")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, SizeT, SizeT)
+
 /// void *__memmove_chk(void *s1, const void *s2, size_t n, size_t s1size);
 TLI_DEFINE_ENUM_INTERNAL(memmove_chk)
 TLI_DEFINE_STRING_INTERNAL("__memmove_chk")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, SizeT, SizeT)
+
 /// void *__mempcpy_chk(void *s1, const void *s2, size_t n, size_t s1size);
 TLI_DEFINE_ENUM_INTERNAL(mempcpy_chk)
 TLI_DEFINE_STRING_INTERNAL("__mempcpy_chk")
-/// void *__memset_chk(void *s, char v, size_t n, size_t s1size);
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, SizeT, SizeT)
+
+/// void *__memset_chk(void *s, int v, size_t n, size_t s1size);
 TLI_DEFINE_ENUM_INTERNAL(memset_chk)
 TLI_DEFINE_STRING_INTERNAL("__memset_chk")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Int, SizeT, SizeT)
 
 // int __nvvm_reflect(const char *)
 TLI_DEFINE_ENUM_INTERNAL(nvvm_reflect)
 TLI_DEFINE_STRING_INTERNAL("__nvvm_reflect")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// double __pow_finite(double x, double y);
 TLI_DEFINE_ENUM_INTERNAL(pow_finite)
 TLI_DEFINE_STRING_INTERNAL("__pow_finite")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl, Dbl)
+
 /// float _powf_finite(float x, float y);
 TLI_DEFINE_ENUM_INTERNAL(powf_finite)
 TLI_DEFINE_STRING_INTERNAL("__powf_finite")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt, Flt)
+
 /// long double __powl_finite(long double x, long double y);
 TLI_DEFINE_ENUM_INTERNAL(powl_finite)
 TLI_DEFINE_STRING_INTERNAL("__powl_finite")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl, LDbl)
+
 /// double __sincospi_stret(double x);
 TLI_DEFINE_ENUM_INTERNAL(sincospi_stret)
 TLI_DEFINE_STRING_INTERNAL("__sincospi_stret")
+TLI_DEFINE_SIG_INTERNAL(/* Checked manually. */)
+
 /// float __sincospif_stret(float x);
 TLI_DEFINE_ENUM_INTERNAL(sincospif_stret)
 TLI_DEFINE_STRING_INTERNAL("__sincospif_stret")
+TLI_DEFINE_SIG_INTERNAL(/* Checked manually. */)
+
 /// double __sinh_finite(double x);
 TLI_DEFINE_ENUM_INTERNAL(sinh_finite)
 TLI_DEFINE_STRING_INTERNAL("__sinh_finite")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float _sinhf_finite(float x);
 TLI_DEFINE_ENUM_INTERNAL(sinhf_finite)
 TLI_DEFINE_STRING_INTERNAL("__sinhf_finite")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double __sinhl_finite(long double x);
 TLI_DEFINE_ENUM_INTERNAL(sinhl_finite)
 TLI_DEFINE_STRING_INTERNAL("__sinhl_finite")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double __sinpi(double x);
 TLI_DEFINE_ENUM_INTERNAL(sinpi)
 TLI_DEFINE_STRING_INTERNAL("__sinpi")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float __sinpif(float x);
 TLI_DEFINE_ENUM_INTERNAL(sinpif)
 TLI_DEFINE_STRING_INTERNAL("__sinpif")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// int __small_fprintf(FILE *stream, const char *format, ...);
 TLI_DEFINE_ENUM_INTERNAL(small_fprintf)
 TLI_DEFINE_STRING_INTERNAL("__small_fprintf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ellip)
+
 /// int __small_printf(const char *format, ...);
 TLI_DEFINE_ENUM_INTERNAL(small_printf)
 TLI_DEFINE_STRING_INTERNAL("__small_printf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ellip)
+
 /// int __small_sprintf(char *str, const char *format, ...);
 TLI_DEFINE_ENUM_INTERNAL(small_sprintf)
 TLI_DEFINE_STRING_INTERNAL("__small_sprintf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ellip)
+
 /// int __snprintf_chk(char *s, size_t n, int flags, size_t slen,
 ///                    const char *format, ...);
 TLI_DEFINE_ENUM_INTERNAL(snprintf_chk)
 TLI_DEFINE_STRING_INTERNAL("__snprintf_chk")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, SizeT, Int, SizeT, Ptr, Ellip)
+
 /// int __sprintf_chk(char *str, int flags, size_t str_len,
 ///                   const char *format, ...);
 TLI_DEFINE_ENUM_INTERNAL(sprintf_chk)
 TLI_DEFINE_STRING_INTERNAL("__sprintf_chk")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Int, SizeT, Ptr, Ellip)
+
 /// double __sqrt_finite(double x);
 TLI_DEFINE_ENUM_INTERNAL(sqrt_finite)
 TLI_DEFINE_STRING_INTERNAL("__sqrt_finite")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float __sqrt_finite(float x);
 TLI_DEFINE_ENUM_INTERNAL(sqrtf_finite)
 TLI_DEFINE_STRING_INTERNAL("__sqrtf_finite")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double __sqrt_finite(long double x);
 TLI_DEFINE_ENUM_INTERNAL(sqrtl_finite)
 TLI_DEFINE_STRING_INTERNAL("__sqrtl_finite")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// char *__stpcpy_chk(char *s1, const char *s2, size_t s1size);
 TLI_DEFINE_ENUM_INTERNAL(stpcpy_chk)
 TLI_DEFINE_STRING_INTERNAL("__stpcpy_chk")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, SizeT)
+
 /// char *__stpncpy_chk(char *s1, const char *s2, size_t n, size_t s1size);
 TLI_DEFINE_ENUM_INTERNAL(stpncpy_chk)
 TLI_DEFINE_STRING_INTERNAL("__stpncpy_chk")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, SizeT, SizeT)
+
 /// char *__strcat_chk(char *s1, const char *s2, size_t s1size);
 TLI_DEFINE_ENUM_INTERNAL(strcat_chk)
 TLI_DEFINE_STRING_INTERNAL("__strcat_chk")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, SizeT)
+
 /// char *__strcpy_chk(char *s1, const char *s2, size_t s1size);
 TLI_DEFINE_ENUM_INTERNAL(strcpy_chk)
 TLI_DEFINE_STRING_INTERNAL("__strcpy_chk")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, SizeT)
+
 /// char * __strdup(const char *s);
 TLI_DEFINE_ENUM_INTERNAL(dunder_strdup)
 TLI_DEFINE_STRING_INTERNAL("__strdup")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr)
+
 /// size_t __strlcat_chk(char *dst, const char *src, size_t size,
 ///                      size_t dstsize);
 TLI_DEFINE_ENUM_INTERNAL(strlcat_chk)
 TLI_DEFINE_STRING_INTERNAL("__strlcat_chk")
+TLI_DEFINE_SIG_INTERNAL(SizeT, Ptr, Ptr, SizeT, SizeT)
+
 /// size_t __strlcpy_chk(char *dst, const char *src, size_t size,
 ///                      size_t dstsize);
 TLI_DEFINE_ENUM_INTERNAL(strlcpy_chk)
 TLI_DEFINE_STRING_INTERNAL("__strlcpy_chk")
+TLI_DEFINE_SIG_INTERNAL(SizeT, Ptr, Ptr, SizeT, SizeT)
+
 /// size_t __strlen_chk(const char *s1, size_t s1size);
 TLI_DEFINE_ENUM_INTERNAL(strlen_chk)
 TLI_DEFINE_STRING_INTERNAL("__strlen_chk")
+TLI_DEFINE_SIG_INTERNAL(SizeT, Ptr, SizeT)
+
 /// char *strncat_chk(char *s1, const char *s2, size_t n, size_t s1size);
 TLI_DEFINE_ENUM_INTERNAL(strncat_chk)
 TLI_DEFINE_STRING_INTERNAL("__strncat_chk")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, SizeT, SizeT)
+
 /// char *__strncpy_chk(char *s1, const char *s2, size_t n, size_t s1size);
 TLI_DEFINE_ENUM_INTERNAL(strncpy_chk)
 TLI_DEFINE_STRING_INTERNAL("__strncpy_chk")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, SizeT, SizeT)
+
 /// char *__strndup(const char *s, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(dunder_strndup)
 TLI_DEFINE_STRING_INTERNAL("__strndup")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, SizeT)
+
 /// char * __strtok_r(char *s, const char *delim, char **save_ptr);
 TLI_DEFINE_ENUM_INTERNAL(dunder_strtok_r)
 TLI_DEFINE_STRING_INTERNAL("__strtok_r")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, Ptr)
+
 /// int __vsnprintf_chk(char *s, size_t n, int flags, size_t slen,
 ///                     const char *format, va_list ap);
 TLI_DEFINE_ENUM_INTERNAL(vsnprintf_chk)
 TLI_DEFINE_STRING_INTERNAL("__vsnprintf_chk")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, SizeT, Int, SizeT, Ptr, Ptr)
+
 /// int __vsprintf_chk(char *s, int flags, size_t slen, const char *format,
 ///                    va_list ap);
 TLI_DEFINE_ENUM_INTERNAL(vsprintf_chk)
 TLI_DEFINE_STRING_INTERNAL("__vsprintf_chk")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Int, SizeT, Ptr, Ptr)
+
 /// int abs(int j);
 TLI_DEFINE_ENUM_INTERNAL(abs)
 TLI_DEFINE_STRING_INTERNAL("abs")
+TLI_DEFINE_SIG_INTERNAL(Int, Int)
+
 /// int access(const char *path, int amode);
 TLI_DEFINE_ENUM_INTERNAL(access)
 TLI_DEFINE_STRING_INTERNAL("access")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Int)
+
 /// double acos(double x);
 TLI_DEFINE_ENUM_INTERNAL(acos)
 TLI_DEFINE_STRING_INTERNAL("acos")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float acosf(float x);
 TLI_DEFINE_ENUM_INTERNAL(acosf)
 TLI_DEFINE_STRING_INTERNAL("acosf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// double acosh(double x);
 TLI_DEFINE_ENUM_INTERNAL(acosh)
 TLI_DEFINE_STRING_INTERNAL("acosh")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float acoshf(float x);
 TLI_DEFINE_ENUM_INTERNAL(acoshf)
 TLI_DEFINE_STRING_INTERNAL("acoshf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double acoshl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(acoshl)
 TLI_DEFINE_STRING_INTERNAL("acoshl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// long double acosl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(acosl)
 TLI_DEFINE_STRING_INTERNAL("acosl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// void *aligned_alloc(size_t alignment, size_t size);
 TLI_DEFINE_ENUM_INTERNAL(aligned_alloc)
 TLI_DEFINE_STRING_INTERNAL("aligned_alloc")
+TLI_DEFINE_SIG_INTERNAL(Ptr, SizeT, SizeT)
+
 /// double asin(double x);
 TLI_DEFINE_ENUM_INTERNAL(asin)
 TLI_DEFINE_STRING_INTERNAL("asin")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float asinf(float x);
 TLI_DEFINE_ENUM_INTERNAL(asinf)
 TLI_DEFINE_STRING_INTERNAL("asinf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// double asinh(double x);
 TLI_DEFINE_ENUM_INTERNAL(asinh)
 TLI_DEFINE_STRING_INTERNAL("asinh")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float asinhf(float x);
 TLI_DEFINE_ENUM_INTERNAL(asinhf)
 TLI_DEFINE_STRING_INTERNAL("asinhf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double asinhl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(asinhl)
 TLI_DEFINE_STRING_INTERNAL("asinhl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// long double asinl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(asinl)
 TLI_DEFINE_STRING_INTERNAL("asinl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double atan(double x);
 TLI_DEFINE_ENUM_INTERNAL(atan)
 TLI_DEFINE_STRING_INTERNAL("atan")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// double atan2(double y, double x);
 TLI_DEFINE_ENUM_INTERNAL(atan2)
 TLI_DEFINE_STRING_INTERNAL("atan2")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl, Dbl)
+
 /// float atan2f(float y, float x);
 TLI_DEFINE_ENUM_INTERNAL(atan2f)
 TLI_DEFINE_STRING_INTERNAL("atan2f")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt, Flt)
+
 /// long double atan2l(long double y, long double x);
 TLI_DEFINE_ENUM_INTERNAL(atan2l)
 TLI_DEFINE_STRING_INTERNAL("atan2l")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl, LDbl)
+
 /// float atanf(float x);
 TLI_DEFINE_ENUM_INTERNAL(atanf)
 TLI_DEFINE_STRING_INTERNAL("atanf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// double atanh(double x);
 TLI_DEFINE_ENUM_INTERNAL(atanh)
 TLI_DEFINE_STRING_INTERNAL("atanh")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float atanhf(float x);
 TLI_DEFINE_ENUM_INTERNAL(atanhf)
 TLI_DEFINE_STRING_INTERNAL("atanhf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double atanhl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(atanhl)
 TLI_DEFINE_STRING_INTERNAL("atanhl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// long double atanl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(atanl)
 TLI_DEFINE_STRING_INTERNAL("atanl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double atof(const char *str);
 TLI_DEFINE_ENUM_INTERNAL(atof)
 TLI_DEFINE_STRING_INTERNAL("atof")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Ptr)
+
 /// int atoi(const char *str);
 TLI_DEFINE_ENUM_INTERNAL(atoi)
 TLI_DEFINE_STRING_INTERNAL("atoi")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// long atol(const char *str);
 TLI_DEFINE_ENUM_INTERNAL(atol)
 TLI_DEFINE_STRING_INTERNAL("atol")
+TLI_DEFINE_SIG_INTERNAL(Long, Ptr)
+
 /// long long atoll(const char *nptr);
 TLI_DEFINE_ENUM_INTERNAL(atoll)
 TLI_DEFINE_STRING_INTERNAL("atoll")
+TLI_DEFINE_SIG_INTERNAL(LLong, Ptr)
+
 /// int bcmp(const void *s1, const void *s2, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(bcmp)
 TLI_DEFINE_STRING_INTERNAL("bcmp")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, SizeT)
+
 /// void bcopy(const void *s1, void *s2, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(bcopy)
 TLI_DEFINE_STRING_INTERNAL("bcopy")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Ptr, SizeT)
+
 /// void bzero(void *s, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(bzero)
 TLI_DEFINE_STRING_INTERNAL("bzero")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, SizeT)
+
 /// double cabs(double complex z)
 TLI_DEFINE_ENUM_INTERNAL(cabs)
 TLI_DEFINE_STRING_INTERNAL("cabs")
+TLI_DEFINE_SIG_INTERNAL(/* Checked manually. */)
+
 /// float cabs(float complex z)
 TLI_DEFINE_ENUM_INTERNAL(cabsf)
 TLI_DEFINE_STRING_INTERNAL("cabsf")
+TLI_DEFINE_SIG_INTERNAL(/* Checked manually. */)
+
 /// long double cabs(long double complex z)
 TLI_DEFINE_ENUM_INTERNAL(cabsl)
 TLI_DEFINE_STRING_INTERNAL("cabsl")
+TLI_DEFINE_SIG_INTERNAL(/* Checked manually. */)
+
 /// void *calloc(size_t count, size_t size);
 TLI_DEFINE_ENUM_INTERNAL(calloc)
 TLI_DEFINE_STRING_INTERNAL("calloc")
+TLI_DEFINE_SIG_INTERNAL(Ptr, SizeT, SizeT)
+
 /// double cbrt(double x);
 TLI_DEFINE_ENUM_INTERNAL(cbrt)
 TLI_DEFINE_STRING_INTERNAL("cbrt")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float cbrtf(float x);
 TLI_DEFINE_ENUM_INTERNAL(cbrtf)
 TLI_DEFINE_STRING_INTERNAL("cbrtf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double cbrtl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(cbrtl)
 TLI_DEFINE_STRING_INTERNAL("cbrtl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double ceil(double x);
 TLI_DEFINE_ENUM_INTERNAL(ceil)
 TLI_DEFINE_STRING_INTERNAL("ceil")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float ceilf(float x);
 TLI_DEFINE_ENUM_INTERNAL(ceilf)
 TLI_DEFINE_STRING_INTERNAL("ceilf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double ceill(long double x);
 TLI_DEFINE_ENUM_INTERNAL(ceill)
 TLI_DEFINE_STRING_INTERNAL("ceill")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// int chmod(const char *path, mode_t mode);
 TLI_DEFINE_ENUM_INTERNAL(chmod)
 TLI_DEFINE_STRING_INTERNAL("chmod")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, IntX)
+
 /// int chown(const char *path, uid_t owner, gid_t group);
 TLI_DEFINE_ENUM_INTERNAL(chown)
 TLI_DEFINE_STRING_INTERNAL("chown")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, IntX, IntX)
+
 /// void clearerr(FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(clearerr)
 TLI_DEFINE_STRING_INTERNAL("clearerr")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr)
+
 /// int closedir(DIR *dirp);
 TLI_DEFINE_ENUM_INTERNAL(closedir)
 TLI_DEFINE_STRING_INTERNAL("closedir")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// double copysign(double x, double y);
 TLI_DEFINE_ENUM_INTERNAL(copysign)
 TLI_DEFINE_STRING_INTERNAL("copysign")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl, Dbl)
+
 /// float copysignf(float x, float y);
 TLI_DEFINE_ENUM_INTERNAL(copysignf)
 TLI_DEFINE_STRING_INTERNAL("copysignf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt, Flt)
+
 /// long double copysignl(long double x, long double y);
 TLI_DEFINE_ENUM_INTERNAL(copysignl)
 TLI_DEFINE_STRING_INTERNAL("copysignl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl, LDbl)
+
 /// double cos(double x);
 TLI_DEFINE_ENUM_INTERNAL(cos)
 TLI_DEFINE_STRING_INTERNAL("cos")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float cosf(float x);
 TLI_DEFINE_ENUM_INTERNAL(cosf)
 TLI_DEFINE_STRING_INTERNAL("cosf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// double cosh(double x);
 TLI_DEFINE_ENUM_INTERNAL(cosh)
 TLI_DEFINE_STRING_INTERNAL("cosh")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float coshf(float x);
 TLI_DEFINE_ENUM_INTERNAL(coshf)
 TLI_DEFINE_STRING_INTERNAL("coshf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double coshl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(coshl)
 TLI_DEFINE_STRING_INTERNAL("coshl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// long double cosl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(cosl)
 TLI_DEFINE_STRING_INTERNAL("cosl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// char *ctermid(char *s);
 TLI_DEFINE_ENUM_INTERNAL(ctermid)
 TLI_DEFINE_STRING_INTERNAL("ctermid")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr)
+
 /// int execl(const char *path, const char *arg, ...);
 TLI_DEFINE_ENUM_INTERNAL(execl)
 TLI_DEFINE_STRING_INTERNAL("execl")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ellip)
+
 /// int execle(const char *file, const char *arg, ..., char * const envp[]);
 TLI_DEFINE_ENUM_INTERNAL(execle)
 TLI_DEFINE_STRING_INTERNAL("execle")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ellip)
+
 /// int execlp(const char *file, const char *arg, ...);
 TLI_DEFINE_ENUM_INTERNAL(execlp)
 TLI_DEFINE_STRING_INTERNAL("execlp")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ellip)
+
 /// int execv(const char *path, char *const argv[]);
 TLI_DEFINE_ENUM_INTERNAL(execv)
 TLI_DEFINE_STRING_INTERNAL("execv")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// int execvP(const char *file, const char *search_path, char *const argv[]);
 TLI_DEFINE_ENUM_INTERNAL(execvP)
 TLI_DEFINE_STRING_INTERNAL("execvP")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ptr)
+
 /// int execve(const char *filename, char *const argv[], char *const envp[]);
 TLI_DEFINE_ENUM_INTERNAL(execve)
 TLI_DEFINE_STRING_INTERNAL("execve")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ptr)
+
 /// int execvp(const char *file, char *const argv[]);
 TLI_DEFINE_ENUM_INTERNAL(execvp)
 TLI_DEFINE_STRING_INTERNAL("execvp")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// int execvpe(const char *file, char *const argv[], char *const envp[]);
 TLI_DEFINE_ENUM_INTERNAL(execvpe)
 TLI_DEFINE_STRING_INTERNAL("execvpe")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ptr)
+
 /// double exp(double x);
 TLI_DEFINE_ENUM_INTERNAL(exp)
 TLI_DEFINE_STRING_INTERNAL("exp")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// double exp10(double x);
 TLI_DEFINE_ENUM_INTERNAL(exp10)
 TLI_DEFINE_STRING_INTERNAL("exp10")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float exp10f(float x);
 TLI_DEFINE_ENUM_INTERNAL(exp10f)
 TLI_DEFINE_STRING_INTERNAL("exp10f")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double exp10l(long double x);
 TLI_DEFINE_ENUM_INTERNAL(exp10l)
 TLI_DEFINE_STRING_INTERNAL("exp10l")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double exp2(double x);
 TLI_DEFINE_ENUM_INTERNAL(exp2)
 TLI_DEFINE_STRING_INTERNAL("exp2")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float exp2f(float x);
 TLI_DEFINE_ENUM_INTERNAL(exp2f)
 TLI_DEFINE_STRING_INTERNAL("exp2f")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double exp2l(long double x);
 TLI_DEFINE_ENUM_INTERNAL(exp2l)
 TLI_DEFINE_STRING_INTERNAL("exp2l")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// float expf(float x);
 TLI_DEFINE_ENUM_INTERNAL(expf)
 TLI_DEFINE_STRING_INTERNAL("expf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double expl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(expl)
 TLI_DEFINE_STRING_INTERNAL("expl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double expm1(double x);
 TLI_DEFINE_ENUM_INTERNAL(expm1)
 TLI_DEFINE_STRING_INTERNAL("expm1")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float expm1f(float x);
 TLI_DEFINE_ENUM_INTERNAL(expm1f)
 TLI_DEFINE_STRING_INTERNAL("expm1f")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double expm1l(long double x);
 TLI_DEFINE_ENUM_INTERNAL(expm1l)
 TLI_DEFINE_STRING_INTERNAL("expm1l")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double fabs(double x);
 TLI_DEFINE_ENUM_INTERNAL(fabs)
 TLI_DEFINE_STRING_INTERNAL("fabs")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float fabsf(float x);
 TLI_DEFINE_ENUM_INTERNAL(fabsf)
 TLI_DEFINE_STRING_INTERNAL("fabsf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double fabsl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(fabsl)
 TLI_DEFINE_STRING_INTERNAL("fabsl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// int fclose(FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(fclose)
 TLI_DEFINE_STRING_INTERNAL("fclose")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// FILE *fdopen(int fildes, const char *mode);
 TLI_DEFINE_ENUM_INTERNAL(fdopen)
 TLI_DEFINE_STRING_INTERNAL("fdopen")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Int, Ptr)
+
 /// int feof(FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(feof)
 TLI_DEFINE_STRING_INTERNAL("feof")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// int ferror(FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(ferror)
 TLI_DEFINE_STRING_INTERNAL("ferror")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// int fflush(FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(fflush)
 TLI_DEFINE_STRING_INTERNAL("fflush")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// int ffs(int i);
 TLI_DEFINE_ENUM_INTERNAL(ffs)
 TLI_DEFINE_STRING_INTERNAL("ffs")
+TLI_DEFINE_SIG_INTERNAL(Int, Int)
+
 /// int ffsl(long int i);
 TLI_DEFINE_ENUM_INTERNAL(ffsl)
 TLI_DEFINE_STRING_INTERNAL("ffsl")
+TLI_DEFINE_SIG_INTERNAL(Int, Long)
+
 /// int ffsll(long long int i);
 TLI_DEFINE_ENUM_INTERNAL(ffsll)
 TLI_DEFINE_STRING_INTERNAL("ffsll")
+TLI_DEFINE_SIG_INTERNAL(Int, LLong)
+
 /// int fgetc(FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(fgetc)
 TLI_DEFINE_STRING_INTERNAL("fgetc")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// int fgetc_unlocked(FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(fgetc_unlocked)
 TLI_DEFINE_STRING_INTERNAL("fgetc_unlocked")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// int fgetpos(FILE *stream, fpos_t *pos);
 TLI_DEFINE_ENUM_INTERNAL(fgetpos)
 TLI_DEFINE_STRING_INTERNAL("fgetpos")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// char *fgets(char *s, int n, FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(fgets)
 TLI_DEFINE_STRING_INTERNAL("fgets")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Int, Ptr)
+
 /// char *fgets_unlocked(char *s, int n, FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(fgets_unlocked)
 TLI_DEFINE_STRING_INTERNAL("fgets_unlocked")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Int, Ptr)
+
 /// int fileno(FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(fileno)
 TLI_DEFINE_STRING_INTERNAL("fileno")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// int fiprintf(FILE *stream, const char *format, ...);
 TLI_DEFINE_ENUM_INTERNAL(fiprintf)
 TLI_DEFINE_STRING_INTERNAL("fiprintf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ellip)
+
 /// void flockfile(FILE *file);
 TLI_DEFINE_ENUM_INTERNAL(flockfile)
 TLI_DEFINE_STRING_INTERNAL("flockfile")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr)
+
 /// double floor(double x);
 TLI_DEFINE_ENUM_INTERNAL(floor)
 TLI_DEFINE_STRING_INTERNAL("floor")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float floorf(float x);
 TLI_DEFINE_ENUM_INTERNAL(floorf)
 TLI_DEFINE_STRING_INTERNAL("floorf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double floorl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(floorl)
 TLI_DEFINE_STRING_INTERNAL("floorl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// int fls(int i);
 TLI_DEFINE_ENUM_INTERNAL(fls)
 TLI_DEFINE_STRING_INTERNAL("fls")
+TLI_DEFINE_SIG_INTERNAL(Int, Int)
+
 /// int flsl(long int i);
 TLI_DEFINE_ENUM_INTERNAL(flsl)
 TLI_DEFINE_STRING_INTERNAL("flsl")
+TLI_DEFINE_SIG_INTERNAL(Int, Long)
+
 /// int flsll(long long int i);
 TLI_DEFINE_ENUM_INTERNAL(flsll)
 TLI_DEFINE_STRING_INTERNAL("flsll")
+TLI_DEFINE_SIG_INTERNAL(Int, LLong)
+
+// Calls to fmax and fmin library functions expand to the llvm.maxnnum and
+// llvm.minnum intrinsics with the correct parameter types for the arguments
+// (all types must match).
 /// double fmax(double x, double y);
 TLI_DEFINE_ENUM_INTERNAL(fmax)
 TLI_DEFINE_STRING_INTERNAL("fmax")
+TLI_DEFINE_SIG_INTERNAL(Floating, Same, Same)
+
 /// float fmaxf(float x, float y);
 TLI_DEFINE_ENUM_INTERNAL(fmaxf)
 TLI_DEFINE_STRING_INTERNAL("fmaxf")
+TLI_DEFINE_SIG_INTERNAL(Floating, Same, Same)
+
 /// long double fmaxl(long double x, long double y);
 TLI_DEFINE_ENUM_INTERNAL(fmaxl)
 TLI_DEFINE_STRING_INTERNAL("fmaxl")
+TLI_DEFINE_SIG_INTERNAL(Floating, Same, Same)
+
 /// double fmin(double x, double y);
 TLI_DEFINE_ENUM_INTERNAL(fmin)
 TLI_DEFINE_STRING_INTERNAL("fmin")
+TLI_DEFINE_SIG_INTERNAL(Floating, Same, Same)
+
 /// float fminf(float x, float y);
 TLI_DEFINE_ENUM_INTERNAL(fminf)
 TLI_DEFINE_STRING_INTERNAL("fminf")
+TLI_DEFINE_SIG_INTERNAL(Floating, Same, Same)
+
 /// long double fminl(long double x, long double y);
 TLI_DEFINE_ENUM_INTERNAL(fminl)
 TLI_DEFINE_STRING_INTERNAL("fminl")
+TLI_DEFINE_SIG_INTERNAL(Floating, Same, Same)
+
 /// double fmod(double x, double y);
 TLI_DEFINE_ENUM_INTERNAL(fmod)
 TLI_DEFINE_STRING_INTERNAL("fmod")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl, Dbl)
+
 /// float fmodf(float x, float y);
 TLI_DEFINE_ENUM_INTERNAL(fmodf)
 TLI_DEFINE_STRING_INTERNAL("fmodf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt, Flt)
+
 /// long double fmodl(long double x, long double y);
 TLI_DEFINE_ENUM_INTERNAL(fmodl)
 TLI_DEFINE_STRING_INTERNAL("fmodl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl, LDbl)
+
 /// FILE *fopen(const char *filename, const char *mode);
 TLI_DEFINE_ENUM_INTERNAL(fopen)
 TLI_DEFINE_STRING_INTERNAL("fopen")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr)
+
 /// FILE *fopen64(const char *filename, const char *opentype)
 TLI_DEFINE_ENUM_INTERNAL(fopen64)
 TLI_DEFINE_STRING_INTERNAL("fopen64")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr)
+
 /// int fork();
 TLI_DEFINE_ENUM_INTERNAL(fork)
 TLI_DEFINE_STRING_INTERNAL("fork")
+TLI_DEFINE_SIG_INTERNAL(Int)
+
 /// int fprintf(FILE *stream, const char *format, ...);
 TLI_DEFINE_ENUM_INTERNAL(fprintf)
 TLI_DEFINE_STRING_INTERNAL("fprintf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ellip)
+
 /// int fputc(int c, FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(fputc)
 TLI_DEFINE_STRING_INTERNAL("fputc")
+TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
+
 /// int fputc_unlocked(int c, FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(fputc_unlocked)
 TLI_DEFINE_STRING_INTERNAL("fputc_unlocked")
+TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
+
 /// int fputs(const char *s, FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(fputs)
 TLI_DEFINE_STRING_INTERNAL("fputs")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// int fputs_unlocked(const char *s, FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(fputs_unlocked)
 TLI_DEFINE_STRING_INTERNAL("fputs_unlocked")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(fread)
 TLI_DEFINE_STRING_INTERNAL("fread")
+TLI_DEFINE_SIG_INTERNAL(SizeT, Ptr, SizeT, SizeT, Ptr)
+
 /// size_t fread_unlocked(void *ptr, size_t size, size_t nitems, FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(fread_unlocked)
 TLI_DEFINE_STRING_INTERNAL("fread_unlocked")
+TLI_DEFINE_SIG_INTERNAL(SizeT, Ptr, SizeT, SizeT, Ptr)
+
 /// void free(void *ptr);
 TLI_DEFINE_ENUM_INTERNAL(free)
 TLI_DEFINE_STRING_INTERNAL("free")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr)
+
 /// double frexp(double num, int *exp);
 TLI_DEFINE_ENUM_INTERNAL(frexp)
 TLI_DEFINE_STRING_INTERNAL("frexp")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl, Ptr)
+
 /// float frexpf(float num, int *exp);
 TLI_DEFINE_ENUM_INTERNAL(frexpf)
 TLI_DEFINE_STRING_INTERNAL("frexpf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt, Ptr)
+
 /// long double frexpl(long double num, int *exp);
 TLI_DEFINE_ENUM_INTERNAL(frexpl)
 TLI_DEFINE_STRING_INTERNAL("frexpl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl, Ptr)
+
 /// int fscanf(FILE *stream, const char *format, ... );
 TLI_DEFINE_ENUM_INTERNAL(fscanf)
 TLI_DEFINE_STRING_INTERNAL("fscanf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ellip)
+
 /// int fseek(FILE *stream, long offset, int whence);
 TLI_DEFINE_ENUM_INTERNAL(fseek)
 TLI_DEFINE_STRING_INTERNAL("fseek")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Long, Int)
+
 /// int fseeko(FILE *stream, off_t offset, int whence);
 TLI_DEFINE_ENUM_INTERNAL(fseeko)
 TLI_DEFINE_STRING_INTERNAL("fseeko")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, IntX, Int)
+
 /// int fseeko64(FILE *stream, off64_t offset, int whence)
 TLI_DEFINE_ENUM_INTERNAL(fseeko64)
 TLI_DEFINE_STRING_INTERNAL("fseeko64")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Int64, Int)
+
 /// int fsetpos(FILE *stream, const fpos_t *pos);
 TLI_DEFINE_ENUM_INTERNAL(fsetpos)
 TLI_DEFINE_STRING_INTERNAL("fsetpos")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// int fstat(int fildes, struct stat *buf);
 TLI_DEFINE_ENUM_INTERNAL(fstat)
 TLI_DEFINE_STRING_INTERNAL("fstat")
+TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
+
 /// int fstat64(int filedes, struct stat64 *buf)
 TLI_DEFINE_ENUM_INTERNAL(fstat64)
 TLI_DEFINE_STRING_INTERNAL("fstat64")
+TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
+
 /// int fstatvfs(int fildes, struct statvfs *buf);
 TLI_DEFINE_ENUM_INTERNAL(fstatvfs)
 TLI_DEFINE_STRING_INTERNAL("fstatvfs")
+TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
+
 /// int fstatvfs64(int fildes, struct statvfs64 *buf);
 TLI_DEFINE_ENUM_INTERNAL(fstatvfs64)
 TLI_DEFINE_STRING_INTERNAL("fstatvfs64")
+TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
+
 /// long ftell(FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(ftell)
 TLI_DEFINE_STRING_INTERNAL("ftell")
+TLI_DEFINE_SIG_INTERNAL(Long, Ptr)
+
 /// off_t ftello(FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(ftello)
 TLI_DEFINE_STRING_INTERNAL("ftello")
+TLI_DEFINE_SIG_INTERNAL(IntPlus, Ptr)
+
 /// off64_t ftello64(FILE *stream)
 TLI_DEFINE_ENUM_INTERNAL(ftello64)
 TLI_DEFINE_STRING_INTERNAL("ftello64")
+TLI_DEFINE_SIG_INTERNAL(Int64, Ptr)
+
 /// int ftrylockfile(FILE *file);
 TLI_DEFINE_ENUM_INTERNAL(ftrylockfile)
 TLI_DEFINE_STRING_INTERNAL("ftrylockfile")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// void funlockfile(FILE *file);
 TLI_DEFINE_ENUM_INTERNAL(funlockfile)
 TLI_DEFINE_STRING_INTERNAL("funlockfile")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr)
+
 /// size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(fwrite)
 TLI_DEFINE_STRING_INTERNAL("fwrite")
+TLI_DEFINE_SIG_INTERNAL(SizeT, Ptr, SizeT, SizeT, Ptr)
+
 /// size_t fwrite_unlocked(const void *ptr, size_t size, size_t nitems, FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(fwrite_unlocked)
 TLI_DEFINE_STRING_INTERNAL("fwrite_unlocked")
+TLI_DEFINE_SIG_INTERNAL(SizeT, Ptr, SizeT, SizeT, Ptr)
+
 /// int getc(FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(getc)
 TLI_DEFINE_STRING_INTERNAL("getc")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// int getc_unlocked(FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(getc_unlocked)
 TLI_DEFINE_STRING_INTERNAL("getc_unlocked")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// int getchar(void);
 TLI_DEFINE_ENUM_INTERNAL(getchar)
 TLI_DEFINE_STRING_INTERNAL("getchar")
+TLI_DEFINE_SIG_INTERNAL(Int)
+
 /// int getchar_unlocked(void);
 TLI_DEFINE_ENUM_INTERNAL(getchar_unlocked)
 TLI_DEFINE_STRING_INTERNAL("getchar_unlocked")
+TLI_DEFINE_SIG_INTERNAL(Int)
+
 /// char *getenv(const char *name);
 TLI_DEFINE_ENUM_INTERNAL(getenv)
 TLI_DEFINE_STRING_INTERNAL("getenv")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr)
+
 /// int getitimer(int which, struct itimerval *value);
 TLI_DEFINE_ENUM_INTERNAL(getitimer)
 TLI_DEFINE_STRING_INTERNAL("getitimer")
+TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
+
 /// int getlogin_r(char *name, size_t namesize);
 TLI_DEFINE_ENUM_INTERNAL(getlogin_r)
 TLI_DEFINE_STRING_INTERNAL("getlogin_r")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, SizeT)
+
 /// struct passwd *getpwnam(const char *name);
 TLI_DEFINE_ENUM_INTERNAL(getpwnam)
 TLI_DEFINE_STRING_INTERNAL("getpwnam")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr)
+
 /// char *gets(char *s);
 TLI_DEFINE_ENUM_INTERNAL(gets)
 TLI_DEFINE_STRING_INTERNAL("gets")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr)
+
 /// int gettimeofday(struct timeval *tp, void *tzp);
 TLI_DEFINE_ENUM_INTERNAL(gettimeofday)
 TLI_DEFINE_STRING_INTERNAL("gettimeofday")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// uint32_t htonl(uint32_t hostlong);
 TLI_DEFINE_ENUM_INTERNAL(htonl)
 TLI_DEFINE_STRING_INTERNAL("htonl")
+TLI_DEFINE_SIG_INTERNAL(Int32, Int32)
+
 /// uint16_t htons(uint16_t hostshort);
 TLI_DEFINE_ENUM_INTERNAL(htons)
 TLI_DEFINE_STRING_INTERNAL("htons")
+TLI_DEFINE_SIG_INTERNAL(Int16, Int16)
+
 /// int iprintf(const char *format, ...);
 TLI_DEFINE_ENUM_INTERNAL(iprintf)
 TLI_DEFINE_STRING_INTERNAL("iprintf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ellip)
+
 /// int isascii(int c);
 TLI_DEFINE_ENUM_INTERNAL(isascii)
 TLI_DEFINE_STRING_INTERNAL("isascii")
+TLI_DEFINE_SIG_INTERNAL(Int, Int)
+
 /// int isdigit(int c);
 TLI_DEFINE_ENUM_INTERNAL(isdigit)
 TLI_DEFINE_STRING_INTERNAL("isdigit")
+TLI_DEFINE_SIG_INTERNAL(Int, Int)
+
 /// long int labs(long int j);
 TLI_DEFINE_ENUM_INTERNAL(labs)
 TLI_DEFINE_STRING_INTERNAL("labs")
+TLI_DEFINE_SIG_INTERNAL(Long, Long)
+
 /// int lchown(const char *path, uid_t owner, gid_t group);
 TLI_DEFINE_ENUM_INTERNAL(lchown)
 TLI_DEFINE_STRING_INTERNAL("lchown")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, IntX, IntX)
+
 /// double ldexp(double x, int n);
 TLI_DEFINE_ENUM_INTERNAL(ldexp)
 TLI_DEFINE_STRING_INTERNAL("ldexp")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl, Int)
+
 /// float ldexpf(float x, int n);
 TLI_DEFINE_ENUM_INTERNAL(ldexpf)
 TLI_DEFINE_STRING_INTERNAL("ldexpf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt, Int)
+
 /// long double ldexpl(long double x, int n);
 TLI_DEFINE_ENUM_INTERNAL(ldexpl)
 TLI_DEFINE_STRING_INTERNAL("ldexpl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl, Int)
+
 /// long long int llabs(long long int j);
 TLI_DEFINE_ENUM_INTERNAL(llabs)
 TLI_DEFINE_STRING_INTERNAL("llabs")
+TLI_DEFINE_SIG_INTERNAL(LLong, LLong)
+
 /// double log(double x);
 TLI_DEFINE_ENUM_INTERNAL(log)
 TLI_DEFINE_STRING_INTERNAL("log")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// double log10(double x);
 TLI_DEFINE_ENUM_INTERNAL(log10)
 TLI_DEFINE_STRING_INTERNAL("log10")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float log10f(float x);
 TLI_DEFINE_ENUM_INTERNAL(log10f)
 TLI_DEFINE_STRING_INTERNAL("log10f")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double log10l(long double x);
 TLI_DEFINE_ENUM_INTERNAL(log10l)
 TLI_DEFINE_STRING_INTERNAL("log10l")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double log1p(double x);
 TLI_DEFINE_ENUM_INTERNAL(log1p)
 TLI_DEFINE_STRING_INTERNAL("log1p")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float log1pf(float x);
 TLI_DEFINE_ENUM_INTERNAL(log1pf)
 TLI_DEFINE_STRING_INTERNAL("log1pf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double log1pl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(log1pl)
 TLI_DEFINE_STRING_INTERNAL("log1pl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double log2(double x);
 TLI_DEFINE_ENUM_INTERNAL(log2)
 TLI_DEFINE_STRING_INTERNAL("log2")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float log2f(float x);
 TLI_DEFINE_ENUM_INTERNAL(log2f)
 TLI_DEFINE_STRING_INTERNAL("log2f")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// double long double log2l(long double x);
 TLI_DEFINE_ENUM_INTERNAL(log2l)
 TLI_DEFINE_STRING_INTERNAL("log2l")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// double logb(double x);
 TLI_DEFINE_ENUM_INTERNAL(logb)
 TLI_DEFINE_STRING_INTERNAL("logb")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float logbf(float x);
 TLI_DEFINE_ENUM_INTERNAL(logbf)
 TLI_DEFINE_STRING_INTERNAL("logbf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double logbl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(logbl)
 TLI_DEFINE_STRING_INTERNAL("logbl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// float logf(float x);
 TLI_DEFINE_ENUM_INTERNAL(logf)
 TLI_DEFINE_STRING_INTERNAL("logf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double logl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(logl)
 TLI_DEFINE_STRING_INTERNAL("logl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// int lstat(const char *path, struct stat *buf);
 TLI_DEFINE_ENUM_INTERNAL(lstat)
 TLI_DEFINE_STRING_INTERNAL("lstat")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// int lstat64(const char *path, struct stat64 *buf);
 TLI_DEFINE_ENUM_INTERNAL(lstat64)
 TLI_DEFINE_STRING_INTERNAL("lstat64")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// void *malloc(size_t size);
 TLI_DEFINE_ENUM_INTERNAL(malloc)
 TLI_DEFINE_STRING_INTERNAL("malloc")
+TLI_DEFINE_SIG_INTERNAL(Ptr, SizeT)
+
 /// void *memalign(size_t boundary, size_t size);
 TLI_DEFINE_ENUM_INTERNAL(memalign)
 TLI_DEFINE_STRING_INTERNAL("memalign")
+TLI_DEFINE_SIG_INTERNAL(Ptr, SizeT, SizeT)
+
 /// void *memccpy(void *s1, const void *s2, int c, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(memccpy)
 TLI_DEFINE_STRING_INTERNAL("memccpy")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, Int, SizeT)
+
 /// void *memchr(const void *s, int c, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(memchr)
 TLI_DEFINE_STRING_INTERNAL("memchr")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Int, SizeT)
+
 /// int memcmp(const void *s1, const void *s2, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(memcmp)
 TLI_DEFINE_STRING_INTERNAL("memcmp")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, SizeT)
+
 /// void *memcpy(void *s1, const void *s2, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(memcpy)
 TLI_DEFINE_STRING_INTERNAL("memcpy")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, SizeT)
+
 /// void *memmove(void *s1, const void *s2, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(memmove)
 TLI_DEFINE_STRING_INTERNAL("memmove")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, SizeT)
+
 /// void *mempcpy(void *s1, const void *s2, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(mempcpy)
 TLI_DEFINE_STRING_INTERNAL("mempcpy")
-// void *memrchr(const void *s, int c, size_t n);
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, SizeT)
+
+/// void *memrchr(const void *s, int c, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(memrchr)
 TLI_DEFINE_STRING_INTERNAL("memrchr")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Int, SizeT)
+
 /// void *memset(void *b, int c, size_t len);
 TLI_DEFINE_ENUM_INTERNAL(memset)
 TLI_DEFINE_STRING_INTERNAL("memset")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Int, SizeT)
+
 /// void memset_pattern16(void *b, const void *pattern16, size_t len);
 TLI_DEFINE_ENUM_INTERNAL(memset_pattern16)
 TLI_DEFINE_STRING_INTERNAL("memset_pattern16")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Ptr, SizeT)
+
 /// void memset_pattern4(void *b, const void *pattern4, size_t len);
 TLI_DEFINE_ENUM_INTERNAL(memset_pattern4)
 TLI_DEFINE_STRING_INTERNAL("memset_pattern4")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Ptr, SizeT)
+
 /// void memset_pattern8(void *b, const void *pattern8, size_t len);
 TLI_DEFINE_ENUM_INTERNAL(memset_pattern8)
 TLI_DEFINE_STRING_INTERNAL("memset_pattern8")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Ptr, SizeT)
+
 /// int mkdir(const char *path, mode_t mode);
 TLI_DEFINE_ENUM_INTERNAL(mkdir)
 TLI_DEFINE_STRING_INTERNAL("mkdir")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, IntX)
+
 /// time_t mktime(struct tm *timeptr);
 TLI_DEFINE_ENUM_INTERNAL(mktime)
 TLI_DEFINE_STRING_INTERNAL("mktime")
+TLI_DEFINE_SIG_INTERNAL(IntPlus, Ptr)
+
 /// double modf(double x, double *iptr);
 TLI_DEFINE_ENUM_INTERNAL(modf)
 TLI_DEFINE_STRING_INTERNAL("modf")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl, Ptr)
+
 /// float modff(float, float *iptr);
 TLI_DEFINE_ENUM_INTERNAL(modff)
 TLI_DEFINE_STRING_INTERNAL("modff")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt, Ptr)
+
 /// long double modfl(long double value, long double *iptr);
 TLI_DEFINE_ENUM_INTERNAL(modfl)
 TLI_DEFINE_STRING_INTERNAL("modfl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl, Ptr)
 
 /// double nearbyint(double x);
 TLI_DEFINE_ENUM_INTERNAL(nearbyint)
 TLI_DEFINE_STRING_INTERNAL("nearbyint")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float nearbyintf(float x);
 TLI_DEFINE_ENUM_INTERNAL(nearbyintf)
 TLI_DEFINE_STRING_INTERNAL("nearbyintf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double nearbyintl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(nearbyintl)
 TLI_DEFINE_STRING_INTERNAL("nearbyintl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// uint32_t ntohl(uint32_t netlong);
 TLI_DEFINE_ENUM_INTERNAL(ntohl)
 TLI_DEFINE_STRING_INTERNAL("ntohl")
+TLI_DEFINE_SIG_INTERNAL(Int32, Int32)
+
 /// uint16_t ntohs(uint16_t netshort);
 TLI_DEFINE_ENUM_INTERNAL(ntohs)
 TLI_DEFINE_STRING_INTERNAL("ntohs")
+TLI_DEFINE_SIG_INTERNAL(Int16, Int16)
+
 /// int open(const char *path, int oflag, ... );
 TLI_DEFINE_ENUM_INTERNAL(open)
 TLI_DEFINE_STRING_INTERNAL("open")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Int, Ellip)
+
 /// int open64(const char *filename, int flags[, mode_t mode])
 TLI_DEFINE_ENUM_INTERNAL(open64)
 TLI_DEFINE_STRING_INTERNAL("open64")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Int, Ellip)
+
 /// DIR *opendir(const char *dirname);
 TLI_DEFINE_ENUM_INTERNAL(opendir)
 TLI_DEFINE_STRING_INTERNAL("opendir")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr)
+
 /// int pclose(FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(pclose)
 TLI_DEFINE_STRING_INTERNAL("pclose")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// void perror(const char *s);
 TLI_DEFINE_ENUM_INTERNAL(perror)
 TLI_DEFINE_STRING_INTERNAL("perror")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr)
+
 /// FILE *popen(const char *command, const char *mode);
 TLI_DEFINE_ENUM_INTERNAL(popen)
 TLI_DEFINE_STRING_INTERNAL("popen")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr)
+
 /// int posix_memalign(void **memptr, size_t alignment, size_t size);
 TLI_DEFINE_ENUM_INTERNAL(posix_memalign)
 TLI_DEFINE_STRING_INTERNAL("posix_memalign")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, SizeT, SizeT)
+
 /// double pow(double x, double y);
 TLI_DEFINE_ENUM_INTERNAL(pow)
 TLI_DEFINE_STRING_INTERNAL("pow")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl, Dbl)
+
 /// float powf(float x, float y);
 TLI_DEFINE_ENUM_INTERNAL(powf)
 TLI_DEFINE_STRING_INTERNAL("powf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt, Flt)
+
 /// long double powl(long double x, long double y);
 TLI_DEFINE_ENUM_INTERNAL(powl)
 TLI_DEFINE_STRING_INTERNAL("powl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl, LDbl)
+
 /// ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset);
 TLI_DEFINE_ENUM_INTERNAL(pread)
 TLI_DEFINE_STRING_INTERNAL("pread")
+TLI_DEFINE_SIG_INTERNAL(SSizeT, Int, Ptr, SizeT, IntPlus)
+
 /// int printf(const char *format, ...);
 TLI_DEFINE_ENUM_INTERNAL(printf)
 TLI_DEFINE_STRING_INTERNAL("printf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ellip)
+
 /// int putc(int c, FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(putc)
 TLI_DEFINE_STRING_INTERNAL("putc")
+TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
+
 /// int putc_unlocked(int c, FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(putc_unlocked)
 TLI_DEFINE_STRING_INTERNAL("putc_unlocked")
+TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
+
 /// int putchar(int c);
 TLI_DEFINE_ENUM_INTERNAL(putchar)
 TLI_DEFINE_STRING_INTERNAL("putchar")
+TLI_DEFINE_SIG_INTERNAL(Int, Int)
+
 /// int putchar_unlocked(int c);
 TLI_DEFINE_ENUM_INTERNAL(putchar_unlocked)
 TLI_DEFINE_STRING_INTERNAL("putchar_unlocked")
+TLI_DEFINE_SIG_INTERNAL(Int, Int)
+
 /// int puts(const char *s);
 TLI_DEFINE_ENUM_INTERNAL(puts)
 TLI_DEFINE_STRING_INTERNAL("puts")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// ssize_t pwrite(int fildes, const void *buf, size_t nbyte, off_t offset);
 TLI_DEFINE_ENUM_INTERNAL(pwrite)
 TLI_DEFINE_STRING_INTERNAL("pwrite")
+TLI_DEFINE_SIG_INTERNAL(SSizeT, Int, Ptr, SizeT, IntPlus)
+
 /// void qsort(void *base, size_t nel, size_t width,
 ///            int (*compar)(const void *, const void *));
 TLI_DEFINE_ENUM_INTERNAL(qsort)
 TLI_DEFINE_STRING_INTERNAL("qsort")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, SizeT, SizeT, Ptr)
+
 /// ssize_t read(int fildes, void *buf, size_t nbyte);
 TLI_DEFINE_ENUM_INTERNAL(read)
 TLI_DEFINE_STRING_INTERNAL("read")
+TLI_DEFINE_SIG_INTERNAL(SSizeT, Int, Ptr, SizeT)
+
 /// ssize_t readlink(const char *path, char *buf, size_t bufsize);
 TLI_DEFINE_ENUM_INTERNAL(readlink)
 TLI_DEFINE_STRING_INTERNAL("readlink")
+TLI_DEFINE_SIG_INTERNAL(SSizeT, Ptr, Ptr, SizeT)
+
 /// void *realloc(void *ptr, size_t size);
 TLI_DEFINE_ENUM_INTERNAL(realloc)
 TLI_DEFINE_STRING_INTERNAL("realloc")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, SizeT)
+
 /// void *reallocf(void *ptr, size_t size);
 TLI_DEFINE_ENUM_INTERNAL(reallocf)
 TLI_DEFINE_STRING_INTERNAL("reallocf")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, SizeT)
+
 /// char *realpath(const char *file_name, char *resolved_name);
 TLI_DEFINE_ENUM_INTERNAL(realpath)
 TLI_DEFINE_STRING_INTERNAL("realpath")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr)
+
 /// double remainder(double x, double y);
 TLI_DEFINE_ENUM_INTERNAL(remainder)
 TLI_DEFINE_STRING_INTERNAL("remainder")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl, Dbl)
+
 /// float remainderf(float x, float y);
 TLI_DEFINE_ENUM_INTERNAL(remainderf)
 TLI_DEFINE_STRING_INTERNAL("remainderf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt, Flt)
+
 /// long double remainderl(long double x, long double y);
 TLI_DEFINE_ENUM_INTERNAL(remainderl)
 TLI_DEFINE_STRING_INTERNAL("remainderl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl, LDbl)
+
 /// int remove(const char *path);
 TLI_DEFINE_ENUM_INTERNAL(remove)
 TLI_DEFINE_STRING_INTERNAL("remove")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// int rename(const char *old, const char *new);
 TLI_DEFINE_ENUM_INTERNAL(rename)
 TLI_DEFINE_STRING_INTERNAL("rename")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// void rewind(FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(rewind)
 TLI_DEFINE_STRING_INTERNAL("rewind")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr)
+
 /// double rint(double x);
 TLI_DEFINE_ENUM_INTERNAL(rint)
 TLI_DEFINE_STRING_INTERNAL("rint")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float rintf(float x);
 TLI_DEFINE_ENUM_INTERNAL(rintf)
 TLI_DEFINE_STRING_INTERNAL("rintf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double rintl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(rintl)
 TLI_DEFINE_STRING_INTERNAL("rintl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// int rmdir(const char *path);
 TLI_DEFINE_ENUM_INTERNAL(rmdir)
 TLI_DEFINE_STRING_INTERNAL("rmdir")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// double round(double x);
 TLI_DEFINE_ENUM_INTERNAL(round)
 TLI_DEFINE_STRING_INTERNAL("round")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// double roundeven(double x);
 TLI_DEFINE_ENUM_INTERNAL(roundeven)
 TLI_DEFINE_STRING_INTERNAL("roundeven")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float roundevenf(float x);
 TLI_DEFINE_ENUM_INTERNAL(roundevenf)
 TLI_DEFINE_STRING_INTERNAL("roundevenf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double roundevenl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(roundevenl)
 TLI_DEFINE_STRING_INTERNAL("roundevenl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// float roundf(float x);
 TLI_DEFINE_ENUM_INTERNAL(roundf)
 TLI_DEFINE_STRING_INTERNAL("roundf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double roundl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(roundl)
 TLI_DEFINE_STRING_INTERNAL("roundl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// int scanf(const char *restrict format, ... );
 TLI_DEFINE_ENUM_INTERNAL(scanf)
 TLI_DEFINE_STRING_INTERNAL("scanf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ellip)
+
 /// void setbuf(FILE *stream, char *buf);
 TLI_DEFINE_ENUM_INTERNAL(setbuf)
 TLI_DEFINE_STRING_INTERNAL("setbuf")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Ptr)
+
 /// int setitimer(int which, const struct itimerval *value,
 ///               struct itimerval *ovalue);
 TLI_DEFINE_ENUM_INTERNAL(setitimer)
 TLI_DEFINE_STRING_INTERNAL("setitimer")
+TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr, Ptr)
+
 /// int setvbuf(FILE *stream, char *buf, int type, size_t size);
 TLI_DEFINE_ENUM_INTERNAL(setvbuf)
 TLI_DEFINE_STRING_INTERNAL("setvbuf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Int, SizeT)
+
 /// double sin(double x);
 TLI_DEFINE_ENUM_INTERNAL(sin)
 TLI_DEFINE_STRING_INTERNAL("sin")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float sinf(float x);
 TLI_DEFINE_ENUM_INTERNAL(sinf)
 TLI_DEFINE_STRING_INTERNAL("sinf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// double sinh(double x);
 TLI_DEFINE_ENUM_INTERNAL(sinh)
 TLI_DEFINE_STRING_INTERNAL("sinh")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float sinhf(float x);
 TLI_DEFINE_ENUM_INTERNAL(sinhf)
 TLI_DEFINE_STRING_INTERNAL("sinhf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double sinhl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(sinhl)
 TLI_DEFINE_STRING_INTERNAL("sinhl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// long double sinl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(sinl)
 TLI_DEFINE_STRING_INTERNAL("sinl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// int siprintf(char *str, const char *format, ...);
 TLI_DEFINE_ENUM_INTERNAL(siprintf)
 TLI_DEFINE_STRING_INTERNAL("siprintf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ellip)
+
 /// int snprintf(char *s, size_t n, const char *format, ...);
 TLI_DEFINE_ENUM_INTERNAL(snprintf)
 TLI_DEFINE_STRING_INTERNAL("snprintf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, SizeT, Ptr, Ellip)
+
 /// int sprintf(char *str, const char *format, ...);
 TLI_DEFINE_ENUM_INTERNAL(sprintf)
 TLI_DEFINE_STRING_INTERNAL("sprintf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ellip)
+
 /// double sqrt(double x);
 TLI_DEFINE_ENUM_INTERNAL(sqrt)
 TLI_DEFINE_STRING_INTERNAL("sqrt")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float sqrtf(float x);
 TLI_DEFINE_ENUM_INTERNAL(sqrtf)
 TLI_DEFINE_STRING_INTERNAL("sqrtf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double sqrtl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(sqrtl)
 TLI_DEFINE_STRING_INTERNAL("sqrtl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// int sscanf(const char *s, const char *format, ... );
 TLI_DEFINE_ENUM_INTERNAL(sscanf)
 TLI_DEFINE_STRING_INTERNAL("sscanf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ellip)
+
 /// int stat(const char *path, struct stat *buf);
 TLI_DEFINE_ENUM_INTERNAL(stat)
 TLI_DEFINE_STRING_INTERNAL("stat")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// int stat64(const char *path, struct stat64 *buf);
 TLI_DEFINE_ENUM_INTERNAL(stat64)
 TLI_DEFINE_STRING_INTERNAL("stat64")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// int statvfs(const char *path, struct statvfs *buf);
 TLI_DEFINE_ENUM_INTERNAL(statvfs)
 TLI_DEFINE_STRING_INTERNAL("statvfs")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// int statvfs64(const char *path, struct statvfs64 *buf)
 TLI_DEFINE_ENUM_INTERNAL(statvfs64)
 TLI_DEFINE_STRING_INTERNAL("statvfs64")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// char *stpcpy(char *s1, const char *s2);
 TLI_DEFINE_ENUM_INTERNAL(stpcpy)
 TLI_DEFINE_STRING_INTERNAL("stpcpy")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr)
+
 /// char *stpncpy(char *s1, const char *s2, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(stpncpy)
 TLI_DEFINE_STRING_INTERNAL("stpncpy")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, SizeT)
+
 /// int strcasecmp(const char *s1, const char *s2);
 TLI_DEFINE_ENUM_INTERNAL(strcasecmp)
 TLI_DEFINE_STRING_INTERNAL("strcasecmp")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// char *strcat(char *s1, const char *s2);
 TLI_DEFINE_ENUM_INTERNAL(strcat)
 TLI_DEFINE_STRING_INTERNAL("strcat")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr)
+
 /// char *strchr(const char *s, int c);
 TLI_DEFINE_ENUM_INTERNAL(strchr)
 TLI_DEFINE_STRING_INTERNAL("strchr")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Int)
+
 /// int strcmp(const char *s1, const char *s2);
 TLI_DEFINE_ENUM_INTERNAL(strcmp)
 TLI_DEFINE_STRING_INTERNAL("strcmp")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// int strcoll(const char *s1, const char *s2);
 TLI_DEFINE_ENUM_INTERNAL(strcoll)
 TLI_DEFINE_STRING_INTERNAL("strcoll")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// char *strcpy(char *s1, const char *s2);
 TLI_DEFINE_ENUM_INTERNAL(strcpy)
 TLI_DEFINE_STRING_INTERNAL("strcpy")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr)
+
 /// size_t strcspn(const char *s1, const char *s2);
 TLI_DEFINE_ENUM_INTERNAL(strcspn)
 TLI_DEFINE_STRING_INTERNAL("strcspn")
+TLI_DEFINE_SIG_INTERNAL(SizeT, Ptr, Ptr)
+
 /// char *strdup(const char *s1);
 TLI_DEFINE_ENUM_INTERNAL(strdup)
 TLI_DEFINE_STRING_INTERNAL("strdup")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr)
+
 /// size_t strlcat(char *dst, const char *src, size_t size);
 TLI_DEFINE_ENUM_INTERNAL(strlcat)
 TLI_DEFINE_STRING_INTERNAL("strlcat")
+TLI_DEFINE_SIG_INTERNAL(SizeT, Ptr, Ptr, SizeT)
+
 /// size_t strlcpy(char *dst, const char *src, size_t size);
 TLI_DEFINE_ENUM_INTERNAL(strlcpy)
 TLI_DEFINE_STRING_INTERNAL("strlcpy")
+TLI_DEFINE_SIG_INTERNAL(SizeT, Ptr, Ptr, SizeT)
+
 /// size_t strlen(const char *s);
 TLI_DEFINE_ENUM_INTERNAL(strlen)
 TLI_DEFINE_STRING_INTERNAL("strlen")
+TLI_DEFINE_SIG_INTERNAL(SizeT, Ptr)
+
 /// int strncasecmp(const char *s1, const char *s2, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(strncasecmp)
 TLI_DEFINE_STRING_INTERNAL("strncasecmp")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, SizeT)
+
 /// char *strncat(char *s1, const char *s2, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(strncat)
 TLI_DEFINE_STRING_INTERNAL("strncat")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, SizeT)
+
 /// int strncmp(const char *s1, const char *s2, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(strncmp)
 TLI_DEFINE_STRING_INTERNAL("strncmp")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, SizeT)
+
 /// char *strncpy(char *s1, const char *s2, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(strncpy)
 TLI_DEFINE_STRING_INTERNAL("strncpy")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, SizeT)
+
 /// char *strndup(const char *s1, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(strndup)
 TLI_DEFINE_STRING_INTERNAL("strndup")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, SizeT)
+
 /// size_t strnlen(const char *s, size_t maxlen);
 TLI_DEFINE_ENUM_INTERNAL(strnlen)
 TLI_DEFINE_STRING_INTERNAL("strnlen")
+TLI_DEFINE_SIG_INTERNAL(SizeT, Ptr, SizeT)
+
 /// char *strpbrk(const char *s1, const char *s2);
 TLI_DEFINE_ENUM_INTERNAL(strpbrk)
 TLI_DEFINE_STRING_INTERNAL("strpbrk")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr)
+
 /// char *strrchr(const char *s, int c);
 TLI_DEFINE_ENUM_INTERNAL(strrchr)
 TLI_DEFINE_STRING_INTERNAL("strrchr")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Int)
+
 /// size_t strspn(const char *s1, const char *s2);
 TLI_DEFINE_ENUM_INTERNAL(strspn)
 TLI_DEFINE_STRING_INTERNAL("strspn")
+TLI_DEFINE_SIG_INTERNAL(SizeT, Ptr, Ptr)
+
 /// char *strstr(const char *s1, const char *s2);
 TLI_DEFINE_ENUM_INTERNAL(strstr)
 TLI_DEFINE_STRING_INTERNAL("strstr")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr)
+
 /// double strtod(const char *nptr, char **endptr);
 TLI_DEFINE_ENUM_INTERNAL(strtod)
 TLI_DEFINE_STRING_INTERNAL("strtod")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Ptr, Ptr)
+
 /// float strtof(const char *nptr, char **endptr);
 TLI_DEFINE_ENUM_INTERNAL(strtof)
 TLI_DEFINE_STRING_INTERNAL("strtof")
-// char *strtok(char *s1, const char *s2);
+TLI_DEFINE_SIG_INTERNAL(Flt, Ptr, Ptr)
+
+/// char *strtok(char *s1, const char *s2);
 TLI_DEFINE_ENUM_INTERNAL(strtok)
 TLI_DEFINE_STRING_INTERNAL("strtok")
-// char *strtok_r(char *s, const char *sep, char **lasts);
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr)
+
+/// char *strtok_r(char *s, const char *sep, char **lasts);
 TLI_DEFINE_ENUM_INTERNAL(strtok_r)
 TLI_DEFINE_STRING_INTERNAL("strtok_r")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr, Ptr)
+
 /// long int strtol(const char *nptr, char **endptr, int base);
 TLI_DEFINE_ENUM_INTERNAL(strtol)
 TLI_DEFINE_STRING_INTERNAL("strtol")
+TLI_DEFINE_SIG_INTERNAL(Long, Ptr, Ptr, Int)
+
 /// long double strtold(const char *nptr, char **endptr);
 TLI_DEFINE_ENUM_INTERNAL(strtold)
 TLI_DEFINE_STRING_INTERNAL("strtold")
+TLI_DEFINE_SIG_INTERNAL(LDbl, Ptr, Ptr)
+
 /// long long int strtoll(const char *nptr, char **endptr, int base);
 TLI_DEFINE_ENUM_INTERNAL(strtoll)
 TLI_DEFINE_STRING_INTERNAL("strtoll")
+TLI_DEFINE_SIG_INTERNAL(LLong, Ptr, Ptr, Int)
+
 /// unsigned long int strtoul(const char *nptr, char **endptr, int base);
 TLI_DEFINE_ENUM_INTERNAL(strtoul)
 TLI_DEFINE_STRING_INTERNAL("strtoul")
+TLI_DEFINE_SIG_INTERNAL(Long, Ptr, Ptr, Int)
+
 /// unsigned long long int strtoull(const char *nptr, char **endptr, int base);
 TLI_DEFINE_ENUM_INTERNAL(strtoull)
 TLI_DEFINE_STRING_INTERNAL("strtoull")
+TLI_DEFINE_SIG_INTERNAL(LLong, Ptr, Ptr, Int)
+
 /// size_t strxfrm(char *s1, const char *s2, size_t n);
 TLI_DEFINE_ENUM_INTERNAL(strxfrm)
 TLI_DEFINE_STRING_INTERNAL("strxfrm")
+TLI_DEFINE_SIG_INTERNAL(SizeT, Ptr, Ptr, SizeT)
+
 /// int system(const char *command);
 TLI_DEFINE_ENUM_INTERNAL(system)
 TLI_DEFINE_STRING_INTERNAL("system")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// double tan(double x);
 TLI_DEFINE_ENUM_INTERNAL(tan)
 TLI_DEFINE_STRING_INTERNAL("tan")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float tanf(float x);
 TLI_DEFINE_ENUM_INTERNAL(tanf)
 TLI_DEFINE_STRING_INTERNAL("tanf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// double tanh(double x);
 TLI_DEFINE_ENUM_INTERNAL(tanh)
 TLI_DEFINE_STRING_INTERNAL("tanh")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float tanhf(float x);
 TLI_DEFINE_ENUM_INTERNAL(tanhf)
 TLI_DEFINE_STRING_INTERNAL("tanhf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double tanhl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(tanhl)
 TLI_DEFINE_STRING_INTERNAL("tanhl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// long double tanl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(tanl)
 TLI_DEFINE_STRING_INTERNAL("tanl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// clock_t times(struct tms *buffer);
 TLI_DEFINE_ENUM_INTERNAL(times)
 TLI_DEFINE_STRING_INTERNAL("times")
+TLI_DEFINE_SIG_INTERNAL(IntPlus, Ptr)
+
 /// FILE *tmpfile(void);
 TLI_DEFINE_ENUM_INTERNAL(tmpfile)
 TLI_DEFINE_STRING_INTERNAL("tmpfile")
+TLI_DEFINE_SIG_INTERNAL(Ptr)
+
 /// FILE *tmpfile64(void)
 TLI_DEFINE_ENUM_INTERNAL(tmpfile64)
 TLI_DEFINE_STRING_INTERNAL("tmpfile64")
+TLI_DEFINE_SIG_INTERNAL(Ptr)
+
 /// int toascii(int c);
 TLI_DEFINE_ENUM_INTERNAL(toascii)
 TLI_DEFINE_STRING_INTERNAL("toascii")
+TLI_DEFINE_SIG_INTERNAL(Int, Int)
+
 /// double trunc(double x);
 TLI_DEFINE_ENUM_INTERNAL(trunc)
 TLI_DEFINE_STRING_INTERNAL("trunc")
+TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl)
+
 /// float truncf(float x);
 TLI_DEFINE_ENUM_INTERNAL(truncf)
 TLI_DEFINE_STRING_INTERNAL("truncf")
+TLI_DEFINE_SIG_INTERNAL(Flt, Flt)
+
 /// long double truncl(long double x);
 TLI_DEFINE_ENUM_INTERNAL(truncl)
 TLI_DEFINE_STRING_INTERNAL("truncl")
+TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
+
 /// int uname(struct utsname *name);
 TLI_DEFINE_ENUM_INTERNAL(uname)
 TLI_DEFINE_STRING_INTERNAL("uname")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// int ungetc(int c, FILE *stream);
 TLI_DEFINE_ENUM_INTERNAL(ungetc)
 TLI_DEFINE_STRING_INTERNAL("ungetc")
+TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
+
 /// int unlink(const char *path);
 TLI_DEFINE_ENUM_INTERNAL(unlink)
 TLI_DEFINE_STRING_INTERNAL("unlink")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// int unsetenv(const char *name);
 TLI_DEFINE_ENUM_INTERNAL(unsetenv)
 TLI_DEFINE_STRING_INTERNAL("unsetenv")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr)
+
 /// int utime(const char *path, const struct utimbuf *times);
 TLI_DEFINE_ENUM_INTERNAL(utime)
 TLI_DEFINE_STRING_INTERNAL("utime")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// int utimes(const char *path, const struct timeval times[2]);
 TLI_DEFINE_ENUM_INTERNAL(utimes)
 TLI_DEFINE_STRING_INTERNAL("utimes")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// void *valloc(size_t size);
 TLI_DEFINE_ENUM_INTERNAL(valloc)
 TLI_DEFINE_STRING_INTERNAL("valloc")
+TLI_DEFINE_SIG_INTERNAL(Ptr, SizeT)
+
 /// void *vec_calloc(size_t count, size_t size);
 TLI_DEFINE_ENUM_INTERNAL(vec_calloc)
 TLI_DEFINE_STRING_INTERNAL("vec_calloc")
+TLI_DEFINE_SIG_INTERNAL(Ptr, SizeT, SizeT)
+
 /// void vec_free(void *ptr);
 TLI_DEFINE_ENUM_INTERNAL(vec_free)
 TLI_DEFINE_STRING_INTERNAL("vec_free")
+TLI_DEFINE_SIG_INTERNAL(Void, Ptr)
+
 /// void *vec_malloc(size_t size);
 TLI_DEFINE_ENUM_INTERNAL(vec_malloc)
 TLI_DEFINE_STRING_INTERNAL("vec_malloc")
+TLI_DEFINE_SIG_INTERNAL(Ptr, SizeT)
+
 /// void *vec_realloc(void *ptr, size_t size);
 TLI_DEFINE_ENUM_INTERNAL(vec_realloc)
 TLI_DEFINE_STRING_INTERNAL("vec_realloc")
+TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, SizeT)
+
 /// int vfprintf(FILE *stream, const char *format, va_list ap);
 TLI_DEFINE_ENUM_INTERNAL(vfprintf)
 TLI_DEFINE_STRING_INTERNAL("vfprintf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ptr)
+
 /// int vfscanf(FILE *stream, const char *format, va_list arg);
 TLI_DEFINE_ENUM_INTERNAL(vfscanf)
 TLI_DEFINE_STRING_INTERNAL("vfscanf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ptr)
+
 /// int vprintf(const char *restrict format, va_list ap);
 TLI_DEFINE_ENUM_INTERNAL(vprintf)
 TLI_DEFINE_STRING_INTERNAL("vprintf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// int vscanf(const char *format, va_list arg);
 TLI_DEFINE_ENUM_INTERNAL(vscanf)
 TLI_DEFINE_STRING_INTERNAL("vscanf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
+
 /// int vsnprintf(char *s, size_t n, const char *format, va_list ap);
 TLI_DEFINE_ENUM_INTERNAL(vsnprintf)
 TLI_DEFINE_STRING_INTERNAL("vsnprintf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, SizeT, Ptr, Ptr)
+
 /// int vsprintf(char *s, const char *format, va_list ap);
 TLI_DEFINE_ENUM_INTERNAL(vsprintf)
 TLI_DEFINE_STRING_INTERNAL("vsprintf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ptr)
+
 /// int vsscanf(const char *s, const char *format, va_list arg);
 TLI_DEFINE_ENUM_INTERNAL(vsscanf)
 TLI_DEFINE_STRING_INTERNAL("vsscanf")
+TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr, Ptr)
+
 /// size_t wcslen (const wchar_t* wcs);
 TLI_DEFINE_ENUM_INTERNAL(wcslen)
 TLI_DEFINE_STRING_INTERNAL("wcslen")
+TLI_DEFINE_SIG_INTERNAL(SizeT, Ptr)
+
 /// ssize_t write(int fildes, const void *buf, size_t nbyte);
 TLI_DEFINE_ENUM_INTERNAL(write)
 TLI_DEFINE_STRING_INTERNAL("write")
+TLI_DEFINE_SIG_INTERNAL(SSizeT, Int, Ptr, SizeT)
 
 #undef TLI_DEFINE_ENUM_INTERNAL
 #undef TLI_DEFINE_STRING_INTERNAL
+#undef TLI_DEFINE_SIG_INTERNAL
 #endif  // One of TLI_DEFINE_ENUM/STRING are defined.
 
 #undef TLI_DEFINE_ENUM
 #undef TLI_DEFINE_STRING
+#undef TLI_DEFINE_SIG

diff  --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index ef20a75ef8800..75b57e75fdd05 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -39,6 +39,40 @@ StringLiteral const TargetLibraryInfoImpl::StandardNames[LibFunc::NumLibFuncs] =
 #include "llvm/Analysis/TargetLibraryInfo.def"
 };
 
+// Recognized types of library function arguments and return types.
+enum FuncArgTypeID : char {
+  Void = 0, // Must be zero.
+  Bool,     // 8 bits on all targets
+  Int16,
+  Int32,
+  Int,
+  IntPlus, // Int or bigger.
+  Long,    // Either 32 or 64 bits.
+  IntX,    // Any integer type.
+  Int64,
+  LLong,    // 64 bits on all targets.
+  SizeT,    // size_t.
+  SSizeT,   // POSIX ssize_t.
+  Flt,      // IEEE float.
+  Dbl,      // IEEE double.
+  LDbl,     // Any floating type (TODO: tighten this up).
+  Floating, // Any floating type.
+  Ptr,      // Any pointer type.
+  Struct,   // Any struct type.
+  Ellip,    // The ellipsis (...).
+  Same,     // Same argument type as the previous one.
+};
+
+typedef std::array<FuncArgTypeID, 8> FuncProtoTy;
+
+static const FuncProtoTy Signatures[] = {
+#define TLI_DEFINE_SIG
+#include "llvm/Analysis/TargetLibraryInfo.def"
+};
+
+static_assert(sizeof Signatures / sizeof *Signatures == LibFunc::NumLibFuncs,
+              "Missing library function signatures");
+
 static bool hasSinCosPiStret(const Triple &T) {
   // Only Darwin variants have _stret versions of combined trig functions.
   if (!T.isOSDarwin())
@@ -912,895 +946,161 @@ bool TargetLibraryInfoImpl::getLibFunc(StringRef funcName, LibFunc &F) const {
   return false;
 }
 
+// Return true if ArgTy matches Ty.
+
+static bool matchType(FuncArgTypeID ArgTy, const Type *Ty, unsigned IntBits,
+                      unsigned SizeTBits) {
+  switch (ArgTy) {
+  case Void:
+    return Ty->isVoidTy();
+  case Bool:
+    return Ty->isIntegerTy(8);
+  case Int16:
+    return Ty->isIntegerTy(16);
+  case Int32:
+    return Ty->isIntegerTy(32);
+  case Int:
+    return Ty->isIntegerTy(IntBits);
+  case IntPlus:
+    return Ty->isIntegerTy() && Ty->getPrimitiveSizeInBits() >= IntBits;
+  case IntX:
+    return Ty->isIntegerTy();
+  case Long:
+    // TODO: Figure out and use long size.
+    return Ty->isIntegerTy() && Ty->getPrimitiveSizeInBits() >= IntBits;
+  case Int64:
+    return Ty->isIntegerTy(64);
+  case LLong:
+    return Ty->isIntegerTy(64);
+  case SizeT:
+  case SSizeT:
+    return Ty->isIntegerTy(SizeTBits);
+  case Flt:
+    return Ty->isFloatTy();
+  case Dbl:
+    return Ty->isDoubleTy();
+    // TODO: Tighten this up.
+  case LDbl:
+    return Ty->isFloatingPointTy();
+  case Floating:
+    return Ty->isFloatingPointTy();
+  case Ptr:
+    return Ty->isPointerTy();
+  case Struct:
+    return Ty->isStructTy();
+  default:
+    break;
+  }
+
+  llvm_unreachable("Invalid type");
+}
+
 bool TargetLibraryInfoImpl::isValidProtoForLibFunc(const FunctionType &FTy,
                                                    LibFunc F,
                                                    const Module &M) const {
-  // FIXME: There is really no guarantee that sizeof(size_t) is equal to
-  // sizeof(int*) for every target. So the assumption used here to derive the
-  // SizeTBits based on the size of an integer pointer in address space zero
-  // isn't always valid.
-  unsigned SizeTBits = M.getDataLayout().getPointerSizeInBits(/*AddrSpace=*/0);
   unsigned NumParams = FTy.getNumParams();
 
   switch (F) {
-  case LibFunc_execl:
-  case LibFunc_execlp:
-  case LibFunc_execle:
-    return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy() &&
-            FTy.getReturnType()->isIntegerTy(32));
-  case LibFunc_execv:
-  case LibFunc_execvp:
-    return (NumParams == 2 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy() &&
-            FTy.getReturnType()->isIntegerTy(32));
-  case LibFunc_execvP:
-  case LibFunc_execvpe:
-  case LibFunc_execve:
-    return (NumParams == 3 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy() &&
-            FTy.getParamType(2)->isPointerTy() &&
-            FTy.getReturnType()->isIntegerTy(32));
-  case LibFunc_strlen_chk:
-    --NumParams;
-    if (!FTy.getParamType(NumParams)->isIntegerTy(SizeTBits))
-      return false;
-    [[fallthrough]];
-  case LibFunc_strlen:
-    return NumParams == 1 && FTy.getParamType(0)->isPointerTy() &&
-           FTy.getReturnType()->isIntegerTy(SizeTBits);
-
-  case LibFunc_strchr:
-  case LibFunc_strrchr:
-    return (NumParams == 2 && FTy.getReturnType()->isPointerTy() &&
-            FTy.getParamType(0) == FTy.getReturnType() &&
-            FTy.getParamType(1)->isIntegerTy());
-
-  case LibFunc_strtol:
-  case LibFunc_strtod:
-  case LibFunc_strtof:
-  case LibFunc_strtoul:
-  case LibFunc_strtoll:
-  case LibFunc_strtold:
-  case LibFunc_strtoull:
-    return ((NumParams == 2 || NumParams == 3) &&
-            FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-  case LibFunc_strcat_chk:
-    --NumParams;
-    if (!FTy.getParamType(NumParams)->isIntegerTy(SizeTBits))
-      return false;
-    [[fallthrough]];
-  case LibFunc_strcat:
-    return (NumParams == 2 && FTy.getReturnType()->isPointerTy() &&
-            FTy.getParamType(0) == FTy.getReturnType() &&
-            FTy.getParamType(1) == FTy.getReturnType());
-
-  case LibFunc_strncat_chk:
-    --NumParams;
-    if (!FTy.getParamType(NumParams)->isIntegerTy(SizeTBits))
-      return false;
-    [[fallthrough]];
-  case LibFunc_strncat:
-    return (NumParams == 3 && FTy.getReturnType()->isPointerTy() &&
-            FTy.getParamType(0) == FTy.getReturnType() &&
-            FTy.getParamType(1) == FTy.getReturnType() &&
-            FTy.getParamType(2)->isIntegerTy(SizeTBits));
-
-  case LibFunc_strcpy_chk:
-  case LibFunc_stpcpy_chk:
-    --NumParams;
-    if (!FTy.getParamType(NumParams)->isIntegerTy(SizeTBits))
-      return false;
-    [[fallthrough]];
-  case LibFunc_strcpy:
-  case LibFunc_stpcpy:
-    return (NumParams == 2 && FTy.getReturnType() == FTy.getParamType(0) &&
-            FTy.getParamType(0) == FTy.getParamType(1) &&
-            FTy.getParamType(0)->isPointerTy());
-
-  case LibFunc_strlcat_chk:
-  case LibFunc_strlcpy_chk:
-    --NumParams;
-    if (!FTy.getParamType(NumParams)->isIntegerTy(SizeTBits))
-      return false;
-    [[fallthrough]];
-  case LibFunc_strlcat:
-  case LibFunc_strlcpy:
-    return NumParams == 3 && FTy.getReturnType()->isIntegerTy(SizeTBits) &&
-           FTy.getParamType(0)->isPointerTy() &&
-           FTy.getParamType(1)->isPointerTy() &&
-           FTy.getParamType(2)->isIntegerTy(SizeTBits);
-
-  case LibFunc_strncpy_chk:
-  case LibFunc_stpncpy_chk:
-    --NumParams;
-    if (!FTy.getParamType(NumParams)->isIntegerTy(SizeTBits))
-      return false;
-    [[fallthrough]];
-  case LibFunc_strncpy:
-  case LibFunc_stpncpy:
-    return (NumParams == 3 && FTy.getReturnType() == FTy.getParamType(0) &&
-            FTy.getParamType(0) == FTy.getParamType(1) &&
-            FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(2)->isIntegerTy(SizeTBits));
-
-  case LibFunc_strxfrm:
-    return (NumParams == 3 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-
-  case LibFunc_strcmp:
-    return (NumParams == 2 && FTy.getReturnType()->isIntegerTy(32) &&
-            FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(0) == FTy.getParamType(1));
-
-  case LibFunc_strncmp:
-    return (NumParams == 3 && FTy.getReturnType()->isIntegerTy(32) &&
-            FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(0) == FTy.getParamType(1) &&
-            FTy.getParamType(2)->isIntegerTy(SizeTBits));
-
-  case LibFunc_strspn:
-  case LibFunc_strcspn:
-    return (NumParams == 2 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(0) == FTy.getParamType(1) &&
-            FTy.getReturnType()->isIntegerTy());
-
-  case LibFunc_strcoll:
-  case LibFunc_strcasecmp:
-  case LibFunc_strncasecmp:
-    return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-
-  case LibFunc_strstr:
-    return (NumParams == 2 && FTy.getReturnType()->isPointerTy() &&
-            FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-
-  case LibFunc_strpbrk:
-    return (NumParams == 2 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getReturnType() == FTy.getParamType(0) &&
-            FTy.getParamType(0) == FTy.getParamType(1));
-
-  case LibFunc_strtok:
-  case LibFunc_strtok_r:
-    return (NumParams >= 2 && FTy.getParamType(1)->isPointerTy());
-  case LibFunc_scanf:
-  case LibFunc_setbuf:
-  case LibFunc_setvbuf:
-    return (NumParams >= 1 && FTy.getParamType(0)->isPointerTy());
-  case LibFunc_strdup:
-  case LibFunc_strndup:
-    return (NumParams >= 1 && FTy.getReturnType()->isPointerTy() &&
-            FTy.getParamType(0)->isPointerTy());
-  case LibFunc_sscanf:
-  case LibFunc_stat:
-  case LibFunc_statvfs:
-  case LibFunc_siprintf:
-  case LibFunc_small_sprintf:
-  case LibFunc_sprintf:
-    return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy() &&
-            FTy.getReturnType()->isIntegerTy(32));
-
-  case LibFunc_sprintf_chk:
-    return NumParams == 4 && FTy.getParamType(0)->isPointerTy() &&
-           FTy.getParamType(1)->isIntegerTy(32) &&
-           FTy.getParamType(2)->isIntegerTy(SizeTBits) &&
-           FTy.getParamType(3)->isPointerTy() &&
-           FTy.getReturnType()->isIntegerTy(32);
-
-  case LibFunc_snprintf:
-    return NumParams == 3 && FTy.getParamType(0)->isPointerTy() &&
-           FTy.getParamType(1)->isIntegerTy(SizeTBits) &&
-           FTy.getParamType(2)->isPointerTy() &&
-           FTy.getReturnType()->isIntegerTy(32);
-
-  case LibFunc_snprintf_chk:
-    return NumParams == 5 && FTy.getParamType(0)->isPointerTy() &&
-           FTy.getParamType(1)->isIntegerTy(SizeTBits) &&
-           FTy.getParamType(2)->isIntegerTy(32) &&
-           FTy.getParamType(3)->isIntegerTy(SizeTBits) &&
-           FTy.getParamType(4)->isPointerTy() &&
-           FTy.getReturnType()->isIntegerTy(32);
-
-  case LibFunc_setitimer:
-    return (NumParams == 3 && FTy.getParamType(1)->isPointerTy() &&
-            FTy.getParamType(2)->isPointerTy());
-  case LibFunc_system:
-    return (NumParams == 1 && FTy.getParamType(0)->isPointerTy());
-  case LibFunc___kmpc_alloc_shared:
-    return NumParams == 1 && FTy.getReturnType()->isPointerTy();
-  case LibFunc_malloc:
-  case LibFunc_vec_malloc:
-    return NumParams == 1 && FTy.getParamType(0)->isIntegerTy(SizeTBits) &&
-           FTy.getReturnType()->isPointerTy();
-  case LibFunc_memcmp:
-    return NumParams == 3 && FTy.getReturnType()->isIntegerTy(32) &&
-           FTy.getParamType(0)->isPointerTy() &&
-           FTy.getParamType(1)->isPointerTy() &&
-           FTy.getParamType(2)->isIntegerTy(SizeTBits);
-
-  case LibFunc_memchr:
-  case LibFunc_memrchr:
-    return (NumParams == 3 && FTy.getReturnType()->isPointerTy() &&
-            FTy.getReturnType() == FTy.getParamType(0) &&
-            FTy.getParamType(1)->isIntegerTy(32) &&
-            FTy.getParamType(2)->isIntegerTy(SizeTBits));
-  case LibFunc_modf:
-  case LibFunc_modff:
-  case LibFunc_modfl:
-    return (NumParams >= 2 && FTy.getParamType(1)->isPointerTy());
-
-  case LibFunc_memcpy_chk:
-  case LibFunc_mempcpy_chk:
-  case LibFunc_memmove_chk:
-    --NumParams;
-    if (!FTy.getParamType(NumParams)->isIntegerTy(SizeTBits))
-      return false;
-    [[fallthrough]];
-  case LibFunc_memcpy:
-  case LibFunc_mempcpy:
-  case LibFunc_memmove:
-    return (NumParams == 3 && FTy.getReturnType() == FTy.getParamType(0) &&
-            FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy() &&
-            FTy.getParamType(2)->isIntegerTy(SizeTBits));
-
-  case LibFunc_memset_chk:
-    --NumParams;
-    if (!FTy.getParamType(NumParams)->isIntegerTy(SizeTBits))
-      return false;
-    [[fallthrough]];
-  case LibFunc_memset:
-    return (NumParams == 3 && FTy.getReturnType() == FTy.getParamType(0) &&
-            FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isIntegerTy() &&
-            FTy.getParamType(2)->isIntegerTy(SizeTBits));
-
-  case LibFunc_memccpy_chk:
-      --NumParams;
-    if (!FTy.getParamType(NumParams)->isIntegerTy(SizeTBits))
-      return false;
-    [[fallthrough]];
-  case LibFunc_memccpy:
-    return (NumParams >= 2 && FTy.getParamType(1)->isPointerTy());
-  case LibFunc_memalign:
-    return (FTy.getReturnType()->isPointerTy());
-  case LibFunc_realloc:
-  case LibFunc_reallocf:
-  case LibFunc_vec_realloc:
-    return (NumParams == 2 && FTy.getReturnType()->isPointerTy() &&
-            FTy.getParamType(0) == FTy.getReturnType() &&
-            FTy.getParamType(1)->isIntegerTy(SizeTBits));
-  case LibFunc_read:
-    return (NumParams == 3 && FTy.getParamType(1)->isPointerTy());
-  case LibFunc_rewind:
-  case LibFunc_rmdir:
-  case LibFunc_remove:
-  case LibFunc_realpath:
-    return (NumParams >= 1 && FTy.getParamType(0)->isPointerTy());
-  case LibFunc_rename:
-    return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-  case LibFunc_readlink:
-    return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-  case LibFunc_write:
-    return (NumParams == 3 && FTy.getParamType(1)->isPointerTy());
-  case LibFunc_aligned_alloc:
-    return (NumParams == 2 && FTy.getReturnType()->isPointerTy());
-  case LibFunc_bcopy:
-  case LibFunc_bcmp:
-    return (NumParams == 3 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-  case LibFunc_bzero:
-    return (NumParams == 2 && FTy.getParamType(0)->isPointerTy());
-  case LibFunc_calloc:
-  case LibFunc_vec_calloc:
-    return (NumParams == 2 && FTy.getReturnType()->isPointerTy() &&
-            FTy.getParamType(0) == FTy.getParamType(1));
-
-  case LibFunc_atof:
-  case LibFunc_atoi:
-  case LibFunc_atol:
-  case LibFunc_atoll:
-  case LibFunc_ferror:
-  case LibFunc_getenv:
-  case LibFunc_getpwnam:
-  case LibFunc_iprintf:
-  case LibFunc_small_printf:
-  case LibFunc_pclose:
-  case LibFunc_perror:
-  case LibFunc_printf:
-  case LibFunc_puts:
-  case LibFunc_uname:
-  case LibFunc_under_IO_getc:
-  case LibFunc_unlink:
-  case LibFunc_unsetenv:
-    return (NumParams == 1 && FTy.getParamType(0)->isPointerTy());
-
-  case LibFunc_access:
-  case LibFunc_chmod:
-  case LibFunc_chown:
-  case LibFunc_clearerr:
-  case LibFunc_closedir:
-  case LibFunc_ctermid:
-  case LibFunc_fclose:
-  case LibFunc_feof:
-  case LibFunc_fflush:
-  case LibFunc_fgetc:
-  case LibFunc_fgetc_unlocked:
-  case LibFunc_fileno:
-  case LibFunc_flockfile:
-  case LibFunc_free:
-  case LibFunc_fseek:
-  case LibFunc_fseeko64:
-  case LibFunc_fseeko:
-  case LibFunc_fsetpos:
-  case LibFunc_ftell:
-  case LibFunc_ftello64:
-  case LibFunc_ftello:
-  case LibFunc_ftrylockfile:
-  case LibFunc_funlockfile:
-  case LibFunc_getc:
-  case LibFunc_getc_unlocked:
-  case LibFunc_getlogin_r:
-  case LibFunc_mkdir:
-  case LibFunc_mktime:
-  case LibFunc_times:
-  case LibFunc_vec_free:
-    return (NumParams != 0 && FTy.getParamType(0)->isPointerTy());
-  case LibFunc___kmpc_free_shared:
-    return (NumParams == 2 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isIntegerTy(SizeTBits));
-
-  case LibFunc_fopen:
-    return (NumParams == 2 && FTy.getReturnType()->isPointerTy() &&
-            FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-  case LibFunc_fork:
-    return (NumParams == 0 && FTy.getReturnType()->isIntegerTy(32));
-  case LibFunc_fdopen:
-    return (NumParams == 2 && FTy.getReturnType()->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-  case LibFunc_fputc:
-  case LibFunc_fputc_unlocked:
-  case LibFunc_fstat:
-  case LibFunc_frexp:
-  case LibFunc_frexpf:
-  case LibFunc_frexpl:
-  case LibFunc_fstatvfs:
-    return (NumParams == 2 && FTy.getParamType(1)->isPointerTy());
-  case LibFunc_fgets:
-  case LibFunc_fgets_unlocked:
-    return (NumParams == 3 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(2)->isPointerTy());
-  case LibFunc_fread:
-  case LibFunc_fread_unlocked:
-    return (NumParams == 4 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(3)->isPointerTy());
-  case LibFunc_fwrite:
-  case LibFunc_fwrite_unlocked:
-    return (NumParams == 4 && FTy.getReturnType()->isIntegerTy() &&
-            FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isIntegerTy() &&
-            FTy.getParamType(2)->isIntegerTy() &&
-            FTy.getParamType(3)->isPointerTy());
-  case LibFunc_fputs:
-  case LibFunc_fputs_unlocked:
-    return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-  case LibFunc_fscanf:
-  case LibFunc_fiprintf:
-  case LibFunc_small_fprintf:
-  case LibFunc_fprintf:
-    return (NumParams >= 2 && FTy.getReturnType()->isIntegerTy() &&
-            FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-  case LibFunc_fgetpos:
-    return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-  case LibFunc_getchar:
-  case LibFunc_getchar_unlocked:
-    return (NumParams == 0 && FTy.getReturnType()->isIntegerTy());
-  case LibFunc_gets:
-    return (NumParams == 1 && FTy.getParamType(0)->isPointerTy());
-  case LibFunc_getitimer:
-    return (NumParams == 2 && FTy.getParamType(1)->isPointerTy());
-  case LibFunc_ungetc:
-    return (NumParams == 2 && FTy.getParamType(1)->isPointerTy());
-  case LibFunc_utime:
-  case LibFunc_utimes:
-    return (NumParams == 2 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-  case LibFunc_putc:
-  case LibFunc_putc_unlocked:
-    return (NumParams == 2 && FTy.getParamType(1)->isPointerTy());
-  case LibFunc_pread:
-  case LibFunc_pwrite:
-    return (NumParams == 4 && FTy.getParamType(1)->isPointerTy());
-  case LibFunc_popen:
-    return (NumParams == 2 && FTy.getReturnType()->isPointerTy() &&
-            FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-  case LibFunc_vscanf:
-    return (NumParams == 2 && FTy.getParamType(1)->isPointerTy());
-  case LibFunc_vsscanf:
-    return (NumParams == 3 && FTy.getParamType(1)->isPointerTy() &&
-            FTy.getParamType(2)->isPointerTy());
-  case LibFunc_vfscanf:
-    return (NumParams == 3 && FTy.getParamType(1)->isPointerTy() &&
-            FTy.getParamType(2)->isPointerTy());
-  case LibFunc_valloc:
-    return (FTy.getReturnType()->isPointerTy());
-  case LibFunc_vprintf:
-    return (NumParams == 2 && FTy.getParamType(0)->isPointerTy());
-  case LibFunc_vfprintf:
-  case LibFunc_vsprintf:
-    return (NumParams == 3 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-  case LibFunc_vsprintf_chk:
-    return NumParams == 5 && FTy.getParamType(0)->isPointerTy() &&
-           FTy.getParamType(1)->isIntegerTy(32) &&
-           FTy.getParamType(2)->isIntegerTy(SizeTBits) && FTy.getParamType(3)->isPointerTy();
-  case LibFunc_vsnprintf:
-    return (NumParams == 4 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(2)->isPointerTy());
-  case LibFunc_vsnprintf_chk:
-    return NumParams == 6 && FTy.getParamType(0)->isPointerTy() &&
-           FTy.getParamType(2)->isIntegerTy(32) &&
-           FTy.getParamType(3)->isIntegerTy(SizeTBits) && FTy.getParamType(4)->isPointerTy();
-  case LibFunc_open:
-    return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy());
-  case LibFunc_opendir:
-    return (NumParams == 1 && FTy.getReturnType()->isPointerTy() &&
-            FTy.getParamType(0)->isPointerTy());
-  case LibFunc_tmpfile:
-    return (FTy.getReturnType()->isPointerTy());
-  case LibFunc_htonl:
-  case LibFunc_ntohl:
-    return (NumParams == 1 && FTy.getReturnType()->isIntegerTy(32) &&
-            FTy.getReturnType() == FTy.getParamType(0));
-  case LibFunc_htons:
-  case LibFunc_ntohs:
-    return (NumParams == 1 && FTy.getReturnType()->isIntegerTy(16) &&
-            FTy.getReturnType() == FTy.getParamType(0));
-  case LibFunc_lstat:
-    return (NumParams == 2 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-  case LibFunc_lchown:
-    return (NumParams == 3 && FTy.getParamType(0)->isPointerTy());
-  case LibFunc_qsort:
-    return (NumParams == 4 && FTy.getParamType(3)->isPointerTy());
-  case LibFunc_dunder_strdup:
-  case LibFunc_dunder_strndup:
-    return (NumParams >= 1 && FTy.getReturnType()->isPointerTy() &&
-            FTy.getParamType(0)->isPointerTy());
-  case LibFunc_dunder_strtok_r:
-    return (NumParams == 3 && FTy.getParamType(1)->isPointerTy());
-  case LibFunc_under_IO_putc:
-    return (NumParams == 2 && FTy.getParamType(1)->isPointerTy());
-  case LibFunc_dunder_isoc99_scanf:
-    return (NumParams >= 1 && FTy.getParamType(0)->isPointerTy());
-  case LibFunc_stat64:
-  case LibFunc_lstat64:
-  case LibFunc_statvfs64:
-    return (NumParams == 2 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-  case LibFunc_dunder_isoc99_sscanf:
-    return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-  case LibFunc_fopen64:
-    return (NumParams == 2 && FTy.getReturnType()->isPointerTy() &&
-            FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-  case LibFunc_tmpfile64:
-    return (FTy.getReturnType()->isPointerTy());
-  case LibFunc_fstat64:
-  case LibFunc_fstatvfs64:
-    return (NumParams == 2 && FTy.getParamType(1)->isPointerTy());
-  case LibFunc_open64:
-    return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy());
-  case LibFunc_gettimeofday:
-    return (NumParams == 2 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy());
-
-  // new(unsigned int);
-  case LibFunc_Znwj:
-  // new(unsigned long);
-  case LibFunc_Znwm:
-  // new[](unsigned int);
-  case LibFunc_Znaj:
-  // new[](unsigned long);
-  case LibFunc_Znam:
-  // new(unsigned int);
-  case LibFunc_msvc_new_int:
-  // new(unsigned long long);
-  case LibFunc_msvc_new_longlong:
-  // new[](unsigned int);
-  case LibFunc_msvc_new_array_int:
-  // new[](unsigned long long);
-  case LibFunc_msvc_new_array_longlong:
-    return (NumParams == 1 && FTy.getReturnType()->isPointerTy());
-
-  // new(unsigned int, nothrow);
-  case LibFunc_ZnwjRKSt9nothrow_t:
-  // new(unsigned long, nothrow);
-  case LibFunc_ZnwmRKSt9nothrow_t:
-  // new[](unsigned int, nothrow);
-  case LibFunc_ZnajRKSt9nothrow_t:
-  // new[](unsigned long, nothrow);
-  case LibFunc_ZnamRKSt9nothrow_t:
-  // new(unsigned int, nothrow);
-  case LibFunc_msvc_new_int_nothrow:
-  // new(unsigned long long, nothrow);
-  case LibFunc_msvc_new_longlong_nothrow:
-  // new[](unsigned int, nothrow);
-  case LibFunc_msvc_new_array_int_nothrow:
-  // new[](unsigned long long, nothrow);
-  case LibFunc_msvc_new_array_longlong_nothrow:
-  // new(unsigned int, align_val_t)
-  case LibFunc_ZnwjSt11align_val_t:
-  // new(unsigned long, align_val_t)
-  case LibFunc_ZnwmSt11align_val_t:
-  // new[](unsigned int, align_val_t)
-  case LibFunc_ZnajSt11align_val_t:
-  // new[](unsigned long, align_val_t)
-  case LibFunc_ZnamSt11align_val_t:
-    return (NumParams == 2 && FTy.getReturnType()->isPointerTy());
-
-  // new(unsigned int, align_val_t, nothrow)
-  case LibFunc_ZnwjSt11align_val_tRKSt9nothrow_t:
-  // new(unsigned long, align_val_t, nothrow)
-  case LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t:
-  // new[](unsigned int, align_val_t, nothrow)
-  case LibFunc_ZnajSt11align_val_tRKSt9nothrow_t:
-  // new[](unsigned long, align_val_t, nothrow)
-  case LibFunc_ZnamSt11align_val_tRKSt9nothrow_t:
-    return (NumParams == 3 && FTy.getReturnType()->isPointerTy());
-
-  // void operator delete[](void*);
-  case LibFunc_ZdaPv:
-  // void operator delete(void*);
-  case LibFunc_ZdlPv:
-  // void operator delete[](void*);
-  case LibFunc_msvc_delete_array_ptr32:
-  // void operator delete[](void*);
-  case LibFunc_msvc_delete_array_ptr64:
-  // void operator delete(void*);
-  case LibFunc_msvc_delete_ptr32:
-  // void operator delete(void*);
-  case LibFunc_msvc_delete_ptr64:
-    return (NumParams == 1 && FTy.getParamType(0)->isPointerTy());
-
-  // void operator delete[](void*, nothrow);
-  case LibFunc_ZdaPvRKSt9nothrow_t:
-  // void operator delete[](void*, unsigned int);
-  case LibFunc_ZdaPvj:
-  // void operator delete[](void*, unsigned long);
-  case LibFunc_ZdaPvm:
-  // void operator delete(void*, nothrow);
-  case LibFunc_ZdlPvRKSt9nothrow_t:
-  // void operator delete(void*, unsigned int);
-  case LibFunc_ZdlPvj:
-  // void operator delete(void*, unsigned long);
-  case LibFunc_ZdlPvm:
-  // void operator delete(void*, align_val_t)
-  case LibFunc_ZdlPvSt11align_val_t:
-  // void operator delete[](void*, align_val_t)
-  case LibFunc_ZdaPvSt11align_val_t:
-  // void operator delete[](void*, unsigned int);
-  case LibFunc_msvc_delete_array_ptr32_int:
-  // void operator delete[](void*, nothrow);
-  case LibFunc_msvc_delete_array_ptr32_nothrow:
-  // void operator delete[](void*, unsigned long long);
-  case LibFunc_msvc_delete_array_ptr64_longlong:
-  // void operator delete[](void*, nothrow);
-  case LibFunc_msvc_delete_array_ptr64_nothrow:
-  // void operator delete(void*, unsigned int);
-  case LibFunc_msvc_delete_ptr32_int:
-  // void operator delete(void*, nothrow);
-  case LibFunc_msvc_delete_ptr32_nothrow:
-  // void operator delete(void*, unsigned long long);
-  case LibFunc_msvc_delete_ptr64_longlong:
-  // void operator delete(void*, nothrow);
-  case LibFunc_msvc_delete_ptr64_nothrow:
-    return (NumParams == 2 && FTy.getParamType(0)->isPointerTy());
-
-  // void operator delete(void*, align_val_t, nothrow)
-  case LibFunc_ZdlPvSt11align_val_tRKSt9nothrow_t:
-  // void operator delete[](void*, align_val_t, nothrow)
-  case LibFunc_ZdaPvSt11align_val_tRKSt9nothrow_t:
-  // void operator delete(void*, unsigned int, align_val_t)
-  case LibFunc_ZdlPvjSt11align_val_t:
-  // void operator delete(void*, unsigned long, align_val_t)
-  case LibFunc_ZdlPvmSt11align_val_t:
-  // void operator delete[](void*, unsigned int, align_val_t);
-  case LibFunc_ZdaPvjSt11align_val_t:
-  // void operator delete[](void*, unsigned long, align_val_t);
-  case LibFunc_ZdaPvmSt11align_val_t:
-    return (NumParams == 3 && FTy.getParamType(0)->isPointerTy());
-
-  // void __atomic_load(size_t, void *, void *, int)
-  case LibFunc_atomic_load:
-  // void __atomic_store(size_t, void *, void *, int)
-  case LibFunc_atomic_store:
-    return (NumParams == 4 && FTy.getParamType(0)->isIntegerTy() &&
-            FTy.getParamType(1)->isPointerTy() &&
-            FTy.getParamType(2)->isPointerTy() &&
-            FTy.getParamType(3)->isIntegerTy());
-
-  case LibFunc_memset_pattern4:
-  case LibFunc_memset_pattern8:
-  case LibFunc_memset_pattern16:
-    return (!FTy.isVarArg() && NumParams == 3 &&
-            FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy() &&
-            FTy.getParamType(2)->isIntegerTy());
-
-  case LibFunc_cxa_guard_abort:
-  case LibFunc_cxa_guard_acquire:
-  case LibFunc_cxa_guard_release:
-  case LibFunc_nvvm_reflect:
-    return (NumParams == 1 && FTy.getParamType(0)->isPointerTy());
-
-  case LibFunc_sincospi_stret:
-  case LibFunc_sincospif_stret:
-    return (NumParams == 1 && FTy.getParamType(0)->isFloatingPointTy());
-
-  case LibFunc_acos:
-  case LibFunc_acos_finite:
-  case LibFunc_acosf:
-  case LibFunc_acosf_finite:
-  case LibFunc_acosh:
-  case LibFunc_acosh_finite:
-  case LibFunc_acoshf:
-  case LibFunc_acoshf_finite:
-  case LibFunc_acoshl:
-  case LibFunc_acoshl_finite:
-  case LibFunc_acosl:
-  case LibFunc_acosl_finite:
-  case LibFunc_asin:
-  case LibFunc_asin_finite:
-  case LibFunc_asinf:
-  case LibFunc_asinf_finite:
-  case LibFunc_asinh:
-  case LibFunc_asinhf:
-  case LibFunc_asinhl:
-  case LibFunc_asinl:
-  case LibFunc_asinl_finite:
-  case LibFunc_atan:
-  case LibFunc_atanf:
-  case LibFunc_atanh:
-  case LibFunc_atanh_finite:
-  case LibFunc_atanhf:
-  case LibFunc_atanhf_finite:
-  case LibFunc_atanhl:
-  case LibFunc_atanhl_finite:
-  case LibFunc_atanl:
-  case LibFunc_cbrt:
-  case LibFunc_cbrtf:
-  case LibFunc_cbrtl:
-  case LibFunc_ceil:
-  case LibFunc_ceilf:
-  case LibFunc_ceill:
-  case LibFunc_cos:
-  case LibFunc_cosf:
-  case LibFunc_cosh:
-  case LibFunc_cosh_finite:
-  case LibFunc_coshf:
-  case LibFunc_coshf_finite:
-  case LibFunc_coshl:
-  case LibFunc_coshl_finite:
-  case LibFunc_cosl:
-  case LibFunc_exp10:
-  case LibFunc_exp10_finite:
-  case LibFunc_exp10f:
-  case LibFunc_exp10f_finite:
-  case LibFunc_exp10l:
-  case LibFunc_exp10l_finite:
-  case LibFunc_exp2:
-  case LibFunc_exp2_finite:
-  case LibFunc_exp2f:
-  case LibFunc_exp2f_finite:
-  case LibFunc_exp2l:
-  case LibFunc_exp2l_finite:
-  case LibFunc_exp:
-  case LibFunc_exp_finite:
-  case LibFunc_expf:
-  case LibFunc_expf_finite:
-  case LibFunc_expl:
-  case LibFunc_expl_finite:
-  case LibFunc_expm1:
-  case LibFunc_expm1f:
-  case LibFunc_expm1l:
-  case LibFunc_fabs:
-  case LibFunc_fabsf:
-  case LibFunc_fabsl:
-  case LibFunc_floor:
-  case LibFunc_floorf:
-  case LibFunc_floorl:
-  case LibFunc_log10:
-  case LibFunc_log10_finite:
-  case LibFunc_log10f:
-  case LibFunc_log10f_finite:
-  case LibFunc_log10l:
-  case LibFunc_log10l_finite:
-  case LibFunc_log1p:
-  case LibFunc_log1pf:
-  case LibFunc_log1pl:
-  case LibFunc_log2:
-  case LibFunc_log2_finite:
-  case LibFunc_log2f:
-  case LibFunc_log2f_finite:
-  case LibFunc_log2l:
-  case LibFunc_log2l_finite:
-  case LibFunc_log:
-  case LibFunc_log_finite:
-  case LibFunc_logb:
-  case LibFunc_logbf:
-  case LibFunc_logbl:
-  case LibFunc_logf:
-  case LibFunc_logf_finite:
-  case LibFunc_logl:
-  case LibFunc_logl_finite:
-  case LibFunc_nearbyint:
-  case LibFunc_nearbyintf:
-  case LibFunc_nearbyintl:
-  case LibFunc_rint:
-  case LibFunc_rintf:
-  case LibFunc_rintl:
-  case LibFunc_round:
-  case LibFunc_roundf:
-  case LibFunc_roundl:
-  case LibFunc_roundeven:
-  case LibFunc_roundevenf:
-  case LibFunc_roundevenl:
-  case LibFunc_sin:
-  case LibFunc_sinf:
-  case LibFunc_sinh:
-  case LibFunc_sinh_finite:
-  case LibFunc_sinhf:
-  case LibFunc_sinhf_finite:
-  case LibFunc_sinhl:
-  case LibFunc_sinhl_finite:
-  case LibFunc_sinl:
-  case LibFunc_sqrt:
-  case LibFunc_sqrt_finite:
-  case LibFunc_sqrtf:
-  case LibFunc_sqrtf_finite:
-  case LibFunc_sqrtl:
-  case LibFunc_sqrtl_finite:
-  case LibFunc_tan:
-  case LibFunc_tanf:
-  case LibFunc_tanh:
-  case LibFunc_tanhf:
-  case LibFunc_tanhl:
-  case LibFunc_tanl:
-  case LibFunc_trunc:
-  case LibFunc_truncf:
-  case LibFunc_truncl:
-    return (NumParams == 1 && FTy.getReturnType()->isFloatingPointTy() &&
-            FTy.getReturnType() == FTy.getParamType(0));
-
-  case LibFunc_atan2:
-  case LibFunc_atan2_finite:
-  case LibFunc_atan2f:
-  case LibFunc_atan2f_finite:
-  case LibFunc_atan2l:
-  case LibFunc_atan2l_finite:
-  case LibFunc_fmin:
-  case LibFunc_fminf:
-  case LibFunc_fminl:
-  case LibFunc_fmax:
-  case LibFunc_fmaxf:
-  case LibFunc_fmaxl:
-  case LibFunc_fmod:
-  case LibFunc_fmodf:
-  case LibFunc_fmodl:
-  case LibFunc_remainder:
-  case LibFunc_remainderf:
-  case LibFunc_remainderl:
-  case LibFunc_copysign:
-  case LibFunc_copysignf:
-  case LibFunc_copysignl:
-  case LibFunc_pow:
-  case LibFunc_pow_finite:
-  case LibFunc_powf:
-  case LibFunc_powf_finite:
-  case LibFunc_powl:
-  case LibFunc_powl_finite:
-    return (NumParams == 2 && FTy.getReturnType()->isFloatingPointTy() &&
-            FTy.getReturnType() == FTy.getParamType(0) &&
-            FTy.getReturnType() == FTy.getParamType(1));
-
-  case LibFunc_ldexp:
-  case LibFunc_ldexpf:
-  case LibFunc_ldexpl:
-    return (NumParams == 2 && FTy.getReturnType()->isFloatingPointTy() &&
-            FTy.getReturnType() == FTy.getParamType(0) &&
-            FTy.getParamType(1)->isIntegerTy(getIntSize()));
-
-  case LibFunc_ffs:
-  case LibFunc_ffsl:
-  case LibFunc_ffsll:
-  case LibFunc_fls:
-  case LibFunc_flsl:
-  case LibFunc_flsll:
-    return (NumParams == 1 && FTy.getReturnType()->isIntegerTy(32) &&
-            FTy.getParamType(0)->isIntegerTy());
-
-  case LibFunc_isdigit:
-  case LibFunc_isascii:
-  case LibFunc_toascii:
-  case LibFunc_putchar:
-  case LibFunc_putchar_unlocked:
-    return (NumParams == 1 && FTy.getReturnType()->isIntegerTy(32) &&
-            FTy.getReturnType() == FTy.getParamType(0));
-
-  case LibFunc_abs:
-  case LibFunc_labs:
-  case LibFunc_llabs:
-    return (NumParams == 1 && FTy.getReturnType()->isIntegerTy() &&
-            FTy.getReturnType() == FTy.getParamType(0));
-
-  case LibFunc_cxa_atexit:
-    return (NumParams == 3 && FTy.getReturnType()->isIntegerTy() &&
-            FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isPointerTy() &&
-            FTy.getParamType(2)->isPointerTy());
-
-  case LibFunc_sinpi:
-  case LibFunc_cospi:
-    return (NumParams == 1 && FTy.getReturnType()->isDoubleTy() &&
-            FTy.getReturnType() == FTy.getParamType(0));
-
-  case LibFunc_sinpif:
-  case LibFunc_cospif:
-    return (NumParams == 1 && FTy.getReturnType()->isFloatTy() &&
-            FTy.getReturnType() == FTy.getParamType(0));
-
-  case LibFunc_strnlen:
-    return (NumParams == 2 && FTy.getReturnType() == FTy.getParamType(1) &&
-            FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isIntegerTy(SizeTBits));
-
-  case LibFunc_posix_memalign:
-    return (NumParams == 3 && FTy.getReturnType()->isIntegerTy(32) &&
-            FTy.getParamType(0)->isPointerTy() &&
-            FTy.getParamType(1)->isIntegerTy(SizeTBits) &&
-            FTy.getParamType(2)->isIntegerTy(SizeTBits));
-
-  case LibFunc_wcslen:
-    return (NumParams == 1 && FTy.getParamType(0)->isPointerTy() &&
-            FTy.getReturnType()->isIntegerTy());
-
+    // Special handling for <complex.h> functions:
   case LibFunc_cabs:
   case LibFunc_cabsf:
   case LibFunc_cabsl: {
-    Type* RetTy = FTy.getReturnType();
+    Type *RetTy = FTy.getReturnType();
     if (!RetTy->isFloatingPointTy())
       return false;
 
+    Type *ParamTy = FTy.getParamType(0);
     // NOTE: These prototypes are target specific and currently support
     // "complex" passed as an array or discrete real & imaginary parameters.
     // Add other calling conventions to enable libcall optimizations.
     if (NumParams == 1)
-      return (FTy.getParamType(0)->isArrayTy() &&
-              FTy.getParamType(0)->getArrayNumElements() == 2 &&
-              FTy.getParamType(0)->getArrayElementType() == RetTy);
+      return (ParamTy->isArrayTy() && ParamTy->getArrayNumElements() == 2 &&
+              ParamTy->getArrayElementType() == RetTy);
     else if (NumParams == 2)
-      return (FTy.getParamType(0) == RetTy && FTy.getParamType(1) == RetTy);
-    else
+      return ParamTy == RetTy && FTy.getParamType(1) == RetTy;
+
+    return false;
+  }
+    // Special handling for the sincospi functions that return either
+    // a struct or vector:
+  case LibFunc_sincospi_stret:
+  case LibFunc_sincospif_stret: {
+    if (NumParams != 1)
       return false;
+
+    Type *RetTy = FTy.getReturnType();
+    Type *ParamTy = FTy.getParamType(0);
+    if (auto *Ty = dyn_cast<StructType>(RetTy)) {
+      if (Ty->getNumElements() != 2)
+        return false;
+      return (Ty->getElementType(0) == ParamTy &&
+              Ty->getElementType(1) == ParamTy);
+    }
+
+    if (auto *Ty = dyn_cast<FixedVectorType>(RetTy)) {
+      if (Ty->getNumElements() != 2)
+        return false;
+      return Ty->getElementType() == ParamTy;
+    }
+
+    return false;
   }
-  case LibFunc::NumLibFuncs:
-  case LibFunc::NotLibFunc:
+
+  default:
     break;
   }
 
-  llvm_unreachable("Invalid libfunc");
+  // FIXME: There is no guarantee that sizeof(size_t) is equal to
+  // sizeof(int*) for every target. So the assumption used here to derive
+  // the SizeTBits based on the size of an integer pointer in address space
+  // zero isn't always valid.
+  unsigned IntBits = getIntSize();
+  unsigned SizeTBits = M.getDataLayout().getPointerSizeInBits(/*AddrSpace=*/0);
+  unsigned Idx = 0;
+
+  // Iterate over the type ids in the function prototype, matching each
+  // against the function's type FTy, starting with its return type.
+  // Return true if both match in number and kind, inclduing the ellipsis.
+  Type *Ty = FTy.getReturnType(), *LastTy = Ty;
+  const auto &ProtoTypes = Signatures[F];
+  for (auto TyID : ProtoTypes) {
+    if (Idx && TyID == Void)
+      // Except in the first position where it designates the function's
+      // return type Void ends the argument list.
+      break;
+
+    if (TyID == Ellip) {
+      // The ellipsis ends the protoype list but is not a part of FTy's
+      // argument list.  Except when it's last it must be followed by
+      // Void.
+      assert(Idx == ProtoTypes.size() - 1 || ProtoTypes[Idx + 1] == Void);
+      return FTy.isFunctionVarArg();
+    }
+
+    if (TyID == Same) {
+      assert(Idx != 0 && "Type ID 'Same' must not be first!");
+      if (Ty != LastTy)
+        return false;
+    } else {
+      if (!Ty || !matchType(TyID, Ty, IntBits, SizeTBits))
+        return false;
+      LastTy = Ty;
+    }
+
+    if (Idx == NumParams) {
+      // There's at least one and at most two more type ids than there are
+      // arguments in FTy's argument list.
+      Ty = nullptr;
+      ++Idx;
+      continue;
+    }
+
+    Ty = FTy.getParamType(Idx++);
+  }
+
+  // Return success only if all entries on both lists have been processed
+  // and the function is not a variadic one.
+  return Idx == NumParams + 1 && !FTy.isFunctionVarArg();
 }
 
 bool TargetLibraryInfoImpl::getLibFunc(const Function &FDecl,

diff  --git a/llvm/test/CodeGen/AMDGPU/complex-folding.ll b/llvm/test/CodeGen/AMDGPU/complex-folding.ll
index acf81ba7b5dd8..cf19b92e3fd8c 100644
--- a/llvm/test/CodeGen/AMDGPU/complex-folding.ll
+++ b/llvm/test/CodeGen/AMDGPU/complex-folding.ll
@@ -5,7 +5,7 @@
 define amdgpu_ps void @main(<4 x float> inreg %reg0) {
 entry:
   %0 = extractelement <4 x float> %reg0, i32 0
-  %1 = call float @fabs(float %0)
+  %1 = call float @fabsf(float %0)
   %2 = fptoui float %1 to i32
   %3 = bitcast i32 %2 to float
   %4 = insertelement <4 x float> undef, float %3, i32 0
@@ -13,5 +13,5 @@ entry:
   ret void
 }
 
-declare float @fabs(float ) readnone
+declare float @fabsf(float ) readnone
 declare void @llvm.r600.store.swizzle(<4 x float>, i32, i32)

diff  --git a/llvm/test/CodeGen/AMDGPU/fabs.ll b/llvm/test/CodeGen/AMDGPU/fabs.ll
index 165e14889316f..12b1792258f15 100644
--- a/llvm/test/CodeGen/AMDGPU/fabs.ll
+++ b/llvm/test/CodeGen/AMDGPU/fabs.ll
@@ -4,38 +4,38 @@
 
 
 ; DAGCombiner will transform:
-; (fabs (f32 bitcast (i32 a))) => (f32 bitcast (and (i32 a), 0x7FFFFFFF))
+; (fabsf (f32 bitcast (i32 a))) => (f32 bitcast (and (i32 a), 0x7FFFFFFF))
 ; unless isFabsFree returns true
 
-; FUNC-LABEL: {{^}}s_fabs_fn_free:
+; FUNC-LABEL: {{^}}s_fabsf_fn_free:
 ; R600-NOT: AND
 ; R600: |PV.{{[XYZW]}}|
 
 ; GCN: s_bitset0_b32 s{{[0-9]+}}, 31
-define amdgpu_kernel void @s_fabs_fn_free(float addrspace(1)* %out, i32 %in) {
+define amdgpu_kernel void @s_fabsf_fn_free(float addrspace(1)* %out, i32 %in) {
   %bc= bitcast i32 %in to float
-  %fabs = call float @fabs(float %bc)
+  %fabs = call float @fabsf(float %bc)
   store float %fabs, float addrspace(1)* %out
   ret void
 }
 
-; FUNC-LABEL: {{^}}s_fabs_free:
+; FUNC-LABEL: {{^}}s_fabsf_free:
 ; R600-NOT: AND
 ; R600: |PV.{{[XYZW]}}|
 
 ; GCN: s_bitset0_b32 s{{[0-9]+}}, 31
-define amdgpu_kernel void @s_fabs_free(float addrspace(1)* %out, i32 %in) {
+define amdgpu_kernel void @s_fabsf_free(float addrspace(1)* %out, i32 %in) {
   %bc= bitcast i32 %in to float
   %fabs = call float @llvm.fabs.f32(float %bc)
   store float %fabs, float addrspace(1)* %out
   ret void
 }
 
-; FUNC-LABEL: {{^}}s_fabs_f32:
+; FUNC-LABEL: {{^}}s_fabsf_f32:
 ; R600: |{{(PV|T[0-9])\.[XYZW]}}|
 
 ; GCN: s_bitset0_b32 s{{[0-9]+}}, 31
-define amdgpu_kernel void @s_fabs_f32(float addrspace(1)* %out, float %in) {
+define amdgpu_kernel void @s_fabsf_f32(float addrspace(1)* %out, float %in) {
   %fabs = call float @llvm.fabs.f32(float %in)
   store float %fabs, float addrspace(1)* %out
   ret void
@@ -53,7 +53,7 @@ define amdgpu_kernel void @fabs_v2f32(<2 x float> addrspace(1)* %out, <2 x float
   ret void
 }
 
-; FUNC-LABEL: {{^}}fabs_v4f32:
+; FUNC-LABEL: {{^}}fabsf_v4f32:
 ; R600: |{{(PV|T[0-9])\.[XYZW]}}|
 ; R600: |{{(PV|T[0-9])\.[XYZW]}}|
 ; R600: |{{(PV|T[0-9])\.[XYZW]}}|
@@ -63,20 +63,20 @@ define amdgpu_kernel void @fabs_v2f32(<2 x float> addrspace(1)* %out, <2 x float
 ; GCN: s_bitset0_b32
 ; GCN: s_bitset0_b32
 ; GCN: s_bitset0_b32
-define amdgpu_kernel void @fabs_v4f32(<4 x float> addrspace(1)* %out, <4 x float> %in) {
+define amdgpu_kernel void @fabsf_v4f32(<4 x float> addrspace(1)* %out, <4 x float> %in) {
   %fabs = call <4 x float> @llvm.fabs.v4f32(<4 x float> %in)
   store <4 x float> %fabs, <4 x float> addrspace(1)* %out
   ret void
 }
 
-; GCN-LABEL: {{^}}fabs_fn_fold:
+; GCN-LABEL: {{^}}fabsf_fn_fold:
 ; SI: s_load_dwordx4 s[[[#LOAD:]]:[[#END:]]], s[{{[0-9]+:[0-9]+}}], 0x9
 ; VI: s_load_dwordx4 s[[[#LOAD:]]:[[#END:]]], s[{{[0-9]+:[0-9]+}}], 0x24
 ; GCN-NOT: and
 ; GCN: v_mov_b32_e32 [[V_MUL_VI:v[0-9]+]], s[[#LOAD + 3]]
 ; GCN: v_mul_f32_e64 v{{[0-9]+}}, |s[[#LOAD + 2]]|, [[V_MUL_VI]]
-define amdgpu_kernel void @fabs_fn_fold(float addrspace(1)* %out, float %in0, float %in1) {
-  %fabs = call float @fabs(float %in0)
+define amdgpu_kernel void @fabsf_fn_fold(float addrspace(1)* %out, float %in0, float %in1) {
+  %fabs = call float @fabsf(float %in0)
   %fmul = fmul float %fabs, %in1
   store float %fmul, float addrspace(1)* %out
   ret void
@@ -95,10 +95,10 @@ define amdgpu_kernel void @fabs_fold(float addrspace(1)* %out, float %in0, float
   ret void
 }
 
-; Make sure we turn some integer operations back into fabs
-; FUNC-LABEL: {{^}}bitpreserve_fabs_f32:
+; Make sure we turn some integer operations back into fabsf
+; FUNC-LABEL: {{^}}bitpreserve_fabsf_f32:
 ; GCN: v_add_f32_e64 v{{[0-9]+}}, |s{{[0-9]+}}|, 1.0
-define amdgpu_kernel void @bitpreserve_fabs_f32(float addrspace(1)* %out, float %in) {
+define amdgpu_kernel void @bitpreserve_fabsf_f32(float addrspace(1)* %out, float %in) {
   %in.bc = bitcast float %in to i32
   %int.abs = and i32 %in.bc, 2147483647
   %bc = bitcast i32 %int.abs to float
@@ -107,7 +107,7 @@ define amdgpu_kernel void @bitpreserve_fabs_f32(float addrspace(1)* %out, float
   ret void
 }
 
-declare float @fabs(float) readnone
+declare float @fabsf(float) readnone
 declare float @llvm.fabs.f32(float) readnone
 declare <2 x float> @llvm.fabs.v2f32(<2 x float>) readnone
 declare <4 x float> @llvm.fabs.v4f32(<4 x float>) readnone

diff  --git a/llvm/test/CodeGen/AMDGPU/floor.ll b/llvm/test/CodeGen/AMDGPU/floor.ll
index 43e58b9422202..cc23289b20b0a 100644
--- a/llvm/test/CodeGen/AMDGPU/floor.ll
+++ b/llvm/test/CodeGen/AMDGPU/floor.ll
@@ -3,12 +3,12 @@
 ; CHECK: FLOOR * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
 define amdgpu_ps void @test(<4 x float> inreg %reg0) {
    %r0 = extractelement <4 x float> %reg0, i32 0
-   %r1 = call float @floor(float %r0)
+   %r1 = call float @floorf(float %r0)
    %vec = insertelement <4 x float> undef, float %r1, i32 0
    call void @llvm.r600.store.swizzle(<4 x float> %vec, i32 0, i32 0)
    ret void
 }
 
-declare float @floor(float) readonly
+declare float @floorf(float) readonly
 declare void @llvm.r600.store.swizzle(<4 x float>, i32, i32)
 

diff  --git a/llvm/test/CodeGen/AMDGPU/fneg-fabs.ll b/llvm/test/CodeGen/AMDGPU/fneg-fabs.ll
index 1d7b0450bd99a..c4133d87795ec 100644
--- a/llvm/test/CodeGen/AMDGPU/fneg-fabs.ll
+++ b/llvm/test/CodeGen/AMDGPU/fneg-fabs.ll
@@ -2,10 +2,10 @@
 ; RUN:  llc -amdgpu-scalarize-global-loads=false  -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck --check-prefixes=VI,FUNC %s
 ; RUN:  llc -amdgpu-scalarize-global-loads=false  -march=r600 -mcpu=redwood < %s | FileCheck --check-prefixes=R600,FUNC %s
 
-; FUNC-LABEL: {{^}}fneg_fabs_fadd_f32:
+; FUNC-LABEL: {{^}}fneg_fabsf_fadd_f32:
 ; SI-NOT: and
 ; SI: v_sub_f32_e64 {{v[0-9]+}}, {{s[0-9]+}}, |{{v[0-9]+}}|
-define amdgpu_kernel void @fneg_fabs_fadd_f32(float addrspace(1)* %out, float %x, float %y) {
+define amdgpu_kernel void @fneg_fabsf_fadd_f32(float addrspace(1)* %out, float %x, float %y) {
   %fabs = call float @llvm.fabs.f32(float %x)
   %fsub = fsub float -0.000000e+00, %fabs
   %fadd = fadd float %y, %fsub
@@ -13,11 +13,11 @@ define amdgpu_kernel void @fneg_fabs_fadd_f32(float addrspace(1)* %out, float %x
   ret void
 }
 
-; FUNC-LABEL: {{^}}fneg_fabs_fmul_f32:
+; FUNC-LABEL: {{^}}fneg_fabsf_fmul_f32:
 ; SI-NOT: and
 ; SI: v_mul_f32_e64 {{v[0-9]+}}, {{s[0-9]+}}, -|{{v[0-9]+}}|
 ; SI-NOT: and
-define amdgpu_kernel void @fneg_fabs_fmul_f32(float addrspace(1)* %out, float %x, float %y) {
+define amdgpu_kernel void @fneg_fabsf_fmul_f32(float addrspace(1)* %out, float %x, float %y) {
   %fabs = call float @llvm.fabs.f32(float %x)
   %fsub = fsub float -0.000000e+00, %fabs
   %fmul = fmul float %y, %fsub
@@ -26,17 +26,17 @@ define amdgpu_kernel void @fneg_fabs_fmul_f32(float addrspace(1)* %out, float %x
 }
 
 ; DAGCombiner will transform:
-; (fabs (f32 bitcast (i32 a))) => (f32 bitcast (and (i32 a), 0x7FFFFFFF))
+; (fabsf (f32 bitcast (i32 a))) => (f32 bitcast (and (i32 a), 0x7FFFFFFF))
 ; unless isFabsFree returns true
 
-; FUNC-LABEL: {{^}}fneg_fabs_free_f32:
+; FUNC-LABEL: {{^}}fneg_fabsf_free_f32:
 ; R600-NOT: AND
 ; R600: |PV.{{[XYZW]}}|
 ; R600: -PV
 
 ; SI: s_or_b32 s{{[0-9]+}}, s{{[0-9]+}}, 0x80000000
 ; VI: s_bitset1_b32 s{{[0-9]+}}, 31
-define amdgpu_kernel void @fneg_fabs_free_f32(float addrspace(1)* %out, i32 %in) {
+define amdgpu_kernel void @fneg_fabsf_free_f32(float addrspace(1)* %out, i32 %in) {
   %bc = bitcast i32 %in to float
   %fabs = call float @llvm.fabs.f32(float %bc)
   %fsub = fsub float -0.000000e+00, %fabs
@@ -44,32 +44,32 @@ define amdgpu_kernel void @fneg_fabs_free_f32(float addrspace(1)* %out, i32 %in)
   ret void
 }
 
-; FUNC-LABEL: {{^}}fneg_fabs_fn_free_f32:
+; FUNC-LABEL: {{^}}fneg_fabsf_fn_free_f32:
 ; R600-NOT: AND
 ; R600: |PV.{{[XYZW]}}|
 ; R600: -PV
 
 ; SI: s_or_b32 s{{[0-9]+}}, s{{[0-9]+}}, 0x80000000
-define amdgpu_kernel void @fneg_fabs_fn_free_f32(float addrspace(1)* %out, i32 %in) {
+define amdgpu_kernel void @fneg_fabsf_fn_free_f32(float addrspace(1)* %out, i32 %in) {
   %bc = bitcast i32 %in to float
-  %fabs = call float @fabs(float %bc)
+  %fabs = call float @fabsf(float %bc)
   %fsub = fsub float -0.000000e+00, %fabs
   store float %fsub, float addrspace(1)* %out
   ret void
 }
 
-; FUNC-LABEL: {{^}}fneg_fabs_f32:
+; FUNC-LABEL: {{^}}fneg_fabsf_f32:
 ; SI: s_or_b32 s{{[0-9]+}}, s{{[0-9]+}}, 0x80000000
-define amdgpu_kernel void @fneg_fabs_f32(float addrspace(1)* %out, float %in) {
+define amdgpu_kernel void @fneg_fabsf_f32(float addrspace(1)* %out, float %in) {
   %fabs = call float @llvm.fabs.f32(float %in)
   %fsub = fsub float -0.000000e+00, %fabs
   store float %fsub, float addrspace(1)* %out, align 4
   ret void
 }
 
-; FUNC-LABEL: {{^}}v_fneg_fabs_f32:
+; FUNC-LABEL: {{^}}v_fneg_fabsf_f32:
 ; SI: v_or_b32_e32 v{{[0-9]+}}, 0x80000000, v{{[0-9]+}}
-define amdgpu_kernel void @v_fneg_fabs_f32(float addrspace(1)* %out, float addrspace(1)* %in) {
+define amdgpu_kernel void @v_fneg_fabsf_f32(float addrspace(1)* %out, float addrspace(1)* %in) {
   %val = load float, float addrspace(1)* %in, align 4
   %fabs = call float @llvm.fabs.f32(float %val)
   %fsub = fsub float -0.000000e+00, %fabs
@@ -77,7 +77,7 @@ define amdgpu_kernel void @v_fneg_fabs_f32(float addrspace(1)* %out, float addrs
   ret void
 }
 
-; FUNC-LABEL: {{^}}fneg_fabs_v2f32:
+; FUNC-LABEL: {{^}}fneg_fabsf_v2f32:
 ; R600: |{{(PV|T[0-9])\.[XYZW]}}|
 ; R600: -PV
 ; R600: |{{(PV|T[0-9])\.[XYZW]}}|
@@ -86,26 +86,26 @@ define amdgpu_kernel void @v_fneg_fabs_f32(float addrspace(1)* %out, float addrs
 ; FIXME: In this case two uses of the constant should be folded
 ; SI: s_bitset1_b32 s{{[0-9]+}}, 31
 ; SI: s_bitset1_b32 s{{[0-9]+}}, 31
-define amdgpu_kernel void @fneg_fabs_v2f32(<2 x float> addrspace(1)* %out, <2 x float> %in) {
+define amdgpu_kernel void @fneg_fabsf_v2f32(<2 x float> addrspace(1)* %out, <2 x float> %in) {
   %fabs = call <2 x float> @llvm.fabs.v2f32(<2 x float> %in)
   %fsub = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, %fabs
   store <2 x float> %fsub, <2 x float> addrspace(1)* %out
   ret void
 }
 
-; FUNC-LABEL: {{^}}fneg_fabs_v4f32:
+; FUNC-LABEL: {{^}}fneg_fabsf_v4f32:
 ; SI: s_bitset1_b32 s{{[0-9]+}}, 31
 ; SI: s_bitset1_b32 s{{[0-9]+}}, 31
 ; SI: s_bitset1_b32 s{{[0-9]+}}, 31
 ; SI: s_bitset1_b32 s{{[0-9]+}}, 31
-define amdgpu_kernel void @fneg_fabs_v4f32(<4 x float> addrspace(1)* %out, <4 x float> %in) {
+define amdgpu_kernel void @fneg_fabsf_v4f32(<4 x float> addrspace(1)* %out, <4 x float> %in) {
   %fabs = call <4 x float> @llvm.fabs.v4f32(<4 x float> %in)
   %fsub = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %fabs
   store <4 x float> %fsub, <4 x float> addrspace(1)* %out
   ret void
 }
 
-declare float @fabs(float) readnone
+declare float @fabsf(float) readnone
 declare float @llvm.fabs.f32(float) readnone
 declare <2 x float> @llvm.fabs.v2f32(<2 x float>) readnone
 declare <4 x float> @llvm.fabs.v4f32(<4 x float>) readnone

diff  --git a/llvm/test/CodeGen/AMDGPU/r600-infinite-loop-bug-while-reorganizing-vector.ll b/llvm/test/CodeGen/AMDGPU/r600-infinite-loop-bug-while-reorganizing-vector.ll
index e2143ff85b72e..54cc43ce36b9f 100644
--- a/llvm/test/CodeGen/AMDGPU/r600-infinite-loop-bug-while-reorganizing-vector.ll
+++ b/llvm/test/CodeGen/AMDGPU/r600-infinite-loop-bug-while-reorganizing-vector.ll
@@ -15,7 +15,7 @@ main_body:
   %tmp11 = extractelement <4 x float> %tmp9, i32 1
   %tmp12 = extractelement <4 x float> %tmp9, i32 2
   %tmp13 = extractelement <4 x float> %tmp9, i32 3
-  %tmp14 = call float @fabs(float %tmp12)
+  %tmp14 = call float @fabsf(float %tmp12)
   %tmp15 = fdiv float 1.000000e+00, %tmp14
   %tmp16 = fmul float %tmp10, %tmp15
   %tmp17 = fadd float %tmp16, 1.500000e+00
@@ -48,7 +48,7 @@ main_body:
 declare <4 x float> @llvm.r600.cube(<4 x float>) #0
 
 ; Function Attrs: readnone
-declare float @fabs(float) #0
+declare float @fabsf(float) #0
 
 declare void @llvm.r600.store.swizzle(<4 x float>, i32, i32)
 

diff  --git a/llvm/test/CodeGen/AMDGPU/schedule-if-2.ll b/llvm/test/CodeGen/AMDGPU/schedule-if-2.ll
index 964298a553187..832b3b3a29203 100644
--- a/llvm/test/CodeGen/AMDGPU/schedule-if-2.ll
+++ b/llvm/test/CodeGen/AMDGPU/schedule-if-2.ll
@@ -17,7 +17,7 @@ main_body:
   br i1 %10, label %IF, label %ELSE
 
 IF:                                               ; preds = %main_body
-  %11 = call float @fabs(float %2)
+  %11 = call float @fabsf(float %2)
   %12 = fcmp ueq float %11, 0x7FF0000000000000
   %13 = select i1 %12, float 1.000000e+00, float 0.000000e+00
   %14 = fsub float -0.000000e+00, %13
@@ -87,7 +87,7 @@ IF23:                                             ; preds = %ELSE
   br label %ENDIF
 }
 
-declare float @fabs(float) #0
+declare float @fabsf(float) #0
 
 declare void @llvm.r600.store.swizzle(<4 x float>, i32, i32)
 

diff  --git a/llvm/test/Transforms/DeadStoreElimination/simple.ll b/llvm/test/Transforms/DeadStoreElimination/simple.ll
index 721124e5384f1..55c494ecdd44d 100644
--- a/llvm/test/Transforms/DeadStoreElimination/simple.ll
+++ b/llvm/test/Transforms/DeadStoreElimination/simple.ll
@@ -266,7 +266,7 @@ define i32 addrspace(1)* @test13_addrspacecast() {
 
 declare noalias i8* @malloc(i64) willreturn allockind("alloc,uninitialized")
 declare noalias i8* @custom_malloc(i32) willreturn
-declare noalias i8* @calloc(i32, i32) willreturn allockind("alloc,zeroed")
+declare noalias i8* @calloc(i64, i64) willreturn allockind("alloc,zeroed")
 
 define void @test14(i32* %Q) {
 ; CHECK-LABEL: @test14(
@@ -321,7 +321,7 @@ define void @test21() {
 ; CHECK-LABEL: @test21(
 ; CHECK-NEXT:    ret void
 ;
-  %m = call i8* @calloc(i32 9, i32 7)
+  %m = call i8* @calloc(i64 9, i64 7)
   store i8 0, i8* %m
   ret void
 }

diff  --git a/llvm/test/Transforms/InferFunctionAttrs/annotate-2.ll b/llvm/test/Transforms/InferFunctionAttrs/annotate-2.ll
new file mode 100644
index 0000000000000..a990f4d5ca462
--- /dev/null
+++ b/llvm/test/Transforms/InferFunctionAttrs/annotate-2.ll
@@ -0,0 +1,109 @@
+; Verify that incompatible declarations of known library functions are
+; not annotated with argument attributes.  This negative test complements
+; annotate.ll.
+;
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -inferattrs -opaque-pointers -S | FileCheck %s --match-full-lines
+
+
+; Exercise <math.h> function declarations.
+
+; Expect double fabs(double).
+declare float @fabs(float)
+; CHECK: declare float @fabs(float)
+
+
+; Exercise <stdio.h> function declarations.
+
+; Expect int fgetc(FILE*).
+declare i32 @fgetc(ptr, i32)
+; CHECK: declare i32 @fgetc(ptr, i32)
+
+; Expect char* fgets(char*, int, FILE*).
+declare i32 @fgets(ptr, i32, ptr)
+; CHECK: declare i32 @fgets(ptr, i32, ptr)
+
+; Expect int sprintf(char*, const char*, ...).
+declare i32 @sprintf(ptr, i64, ptr, ...)
+; CHECK: declare i32 @sprintf(ptr, i64, ptr, ...)
+
+; Expect int snprintf(char*, size_t, const char*, ...).
+declare i32 @snprintf(ptr, i64, ptr)
+; CHECK: declare i32 @snprintf(ptr, i64, ptr)
+
+; Expect int sscanf(const char*, const char*, ...).
+declare i32 @sscanf(ptr, ...)
+; CHECK: declare i32 @sscanf(ptr, ...)
+
+
+; Exercise <stdlib.h> function declarations.
+
+; Expect int atoi(const char*).
+declare i8 @atoi(ptr)
+; CHECK: declare i8 @atoi(ptr)
+
+; Expect long long atoll(const char*).
+declare i1 @atoll(ptr)
+; CHECK: declare i1 @atoll(ptr)
+
+; Expect double atof(const char*).
+declare float @atof(ptr)
+; CHECK: declare float @atof(ptr)
+
+; Expect double strtod(const char*, char**).
+declare double @strtod(ptr, ptr, i32)
+; CHECK: declare double @strtod(ptr, ptr, i32)
+
+; Expect float strtof(const char*, char**).
+declare double @strtof(ptr, ptr)
+; CHECK: declare double @strtof(ptr, ptr)
+
+
+; Exercise <string.h> function declarations.
+
+; Expect void* memccpy(void*, const void*, int, size_t).
+declare ptr @memccpy(ptr, ptr, i64, i64)
+; CHECK: declare ptr @memccpy(ptr, ptr, i64, i64)
+
+; Expect int strcasecmp(const char*, const char*).
+declare i1 @strcasecmp(ptr, ptr)
+; CHECK: declare i1 @strcasecmp(ptr, ptr)
+
+; Expect int strcoll(const char*, const char*).
+declare ptr @strcoll(ptr, ptr)
+; CHECK: declare ptr @strcoll(ptr, ptr)
+
+; Expect int strncasecmp(const char*, const char*, size_t).
+declare i32 @strncasecmp(ptr, ptr, i64, i64)
+; CHECK: declare i32 @strncasecmp(ptr, ptr, i64, i64)
+
+; Expect int strxfrm(const char*, const char*).
+declare i16 @strxfrm(ptr, ptr)
+; CHECK: declare i16 @strxfrm(ptr, ptr)
+
+; Expect char* strtok(const char*, const char*).
+declare ptr @strtok(ptr, i8)
+; CHECK: declare ptr @strtok(ptr, i8)
+
+; Expect char* strtok_r(const char*, const char*, char**).
+declare ptr @strtok_r(ptr, ptr, i64)
+; CHECK: declare ptr @strtok_r(ptr, ptr, i64)
+
+; Expect char* strdup(const char*).
+declare ptr @strdup(ptr, i64)
+; CHECK: declare ptr @strdup(ptr, i64)
+
+; Expect char* strndup(const char*, size_t).
+declare ptr @strndup(ptr, i64, i64)
+; CHECK: declare ptr @strndup(ptr, i64, i64)
+
+
+; Exercise <sys/stat.h> and <sys/statvfs.h> function declarations.
+
+; Expect int stat(const char*, struct stat*).
+declare i32 @stat(ptr, ptr, i64)
+; CHECK: declare i32 @stat(ptr, ptr, i64)
+
+; Expect int statvfs(const char*, struct statvfs*).
+declare i32 @statvfs(ptr, ptr, i64)
+; CHECK: declare i32 @statvfs(ptr, ptr, i64)

diff  --git a/llvm/test/Transforms/InferFunctionAttrs/annotate.ll b/llvm/test/Transforms/InferFunctionAttrs/annotate.ll
index 4cead43e9d456..5e795b9baf07a 100644
--- a/llvm/test/Transforms/InferFunctionAttrs/annotate.ll
+++ b/llvm/test/Transforms/InferFunctionAttrs/annotate.ll
@@ -314,6 +314,11 @@ declare float @ceilf(float)
 ; CHECK: declare x86_fp80 @ceill(x86_fp80) [[NOFREE_NOUNWIND_WILLRETURN_WRITEONLY]]
 declare x86_fp80 @ceill(x86_fp80)
 
+; The second argument of int chmod(FILE*, mode_t) is a 32-bit int on most
+; targets but it's a 16-bit short on Apple Darwin.  Use i16 here to verify
+; the function is still recognized.
+; FIXME: this should be tightened up to verify that only the type with
+; the right size for the target matches.
 ; CHECK: declare noundef i32 @chmod(i8* nocapture noundef readonly, i16 noundef zeroext) [[NOFREE_NOUNWIND]]
 declare i32 @chmod(i8*, i16 zeroext)
 

diff  --git a/llvm/test/Transforms/InstCombine/bcopy.ll b/llvm/test/Transforms/InstCombine/bcopy.ll
index db25a810c9c8a..b4c4ef5546f54 100644
--- a/llvm/test/Transforms/InstCombine/bcopy.ll
+++ b/llvm/test/Transforms/InstCombine/bcopy.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -passes=instcombine -S | FileCheck %s
+; RUN: opt < %s -passes=instcombine -data-layout=p:32:32 -S | FileCheck %s
 
 declare void @bcopy(i8* nocapture readonly, i8* nocapture, i32)
 

diff  --git a/llvm/test/Transforms/InstCombine/deref-alloc-fns.ll b/llvm/test/Transforms/InstCombine/deref-alloc-fns.ll
index a62c4224c5f25..42c28e42693e7 100644
--- a/llvm/test/Transforms/InstCombine/deref-alloc-fns.ll
+++ b/llvm/test/Transforms/InstCombine/deref-alloc-fns.ll
@@ -12,7 +12,8 @@ declare noalias i8* @strdup(i8*)
 declare noalias i8* @aligned_alloc(i64 allocalign, i64) allockind("alloc,uninitialized,aligned") allocsize(1) "alloc-family"="malloc"
 declare noalias align 16 i8* @memalign(i64, i64)
 ; new[](unsigned int, align_val_t)
-declare noalias i8* @_ZnajSt11align_val_t(i64 %size, i64 %align)
+declare noalias i8* @_ZnamSt11align_val_t(i64 %size, i64 %align)
+
 declare i8* @my_malloc(i64) allocsize(0)
 declare i8* @my_calloc(i64, i64) allocsize(0, 1)
 
@@ -349,10 +350,10 @@ bb:
 
 define noalias i8* @op_new_align() {
 ; CHECK-LABEL: @op_new_align(
-; CHECK-NEXT:    [[CALL:%.*]] = tail call align 32 dereferenceable_or_null(32) i8* @_ZnajSt11align_val_t(i64 32, i64 32)
+; CHECK-NEXT:    [[CALL:%.*]] = tail call align 32 dereferenceable_or_null(32) i8* @_ZnamSt11align_val_t(i64 32, i64 32)
 ; CHECK-NEXT:    ret i8* [[CALL]]
 ;
-  %call = tail call i8* @_ZnajSt11align_val_t(i64 32, i64 32)
+  %call = tail call i8* @_ZnamSt11align_val_t(i64 32, i64 32)
   ret i8* %call
 }
 

diff  --git a/llvm/test/Transforms/InstCombine/fprintf-1.ll b/llvm/test/Transforms/InstCombine/fprintf-1.ll
index 4bbe216293005..b6f22daf4f395 100644
--- a/llvm/test/Transforms/InstCombine/fprintf-1.ll
+++ b/llvm/test/Transforms/InstCombine/fprintf-1.ll
@@ -12,6 +12,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
 @percent_d = constant [3 x i8] c"%d\00"
 @percent_f = constant [3 x i8] c"%f\00"
 @percent_s = constant [3 x i8] c"%s\00"
+ at percent_m = constant [3 x i8] c"%m\00"
 
 declare i32 @fprintf(%FILE*, i8*, ...)
 
@@ -96,3 +97,15 @@ define i32 @test_no_simplify3(%FILE* %fp) {
   ret i32 %1
 ; CHECK-NEXT: ret i32 %1
 }
+
+; Verify that a call with a format string containing just the %m directive
+; and no arguments is not simplified.
+
+define void @test_no_simplify4(%FILE* %fp) {
+; CHECK-LABEL: @test_no_simplify4(
+  %fmt = getelementptr [3 x i8], [3 x i8]* @percent_m, i32 0, i32 0
+  call i32 (%FILE*, i8*, ...) @fprintf(%FILE* %fp, i8* %fmt)
+; CHECK-NEXT: call i32 (%FILE*, i8*, ...) @fprintf(%FILE* %fp, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @percent_m, i32 0, i32 0))
+  ret void
+; CHECK-NEXT: ret void
+}

diff  --git a/llvm/test/Transforms/InstCombine/fwrite-1.ll b/llvm/test/Transforms/InstCombine/fwrite-1.ll
index c72c8384d1316..a0ef812da037b 100644
--- a/llvm/test/Transforms/InstCombine/fwrite-1.ll
+++ b/llvm/test/Transforms/InstCombine/fwrite-1.ll
@@ -2,7 +2,7 @@
 ;
 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
 
-target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target datalayout = "e-p:64:64:64"
 
 %FILE = type { }
 

diff  --git a/llvm/test/Transforms/InstCombine/mem-deref-bytes-addrspaces.ll b/llvm/test/Transforms/InstCombine/mem-deref-bytes-addrspaces.ll
index 4cc18f538751c..15ac31b676b1a 100644
--- a/llvm/test/Transforms/InstCombine/mem-deref-bytes-addrspaces.ll
+++ b/llvm/test/Transforms/InstCombine/mem-deref-bytes-addrspaces.ll
@@ -1,22 +1,22 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt -passes=instcombine  -S < %s | FileCheck %s
 
-declare i32 @memcmp(i8 addrspace(1)* nocapture, i8* nocapture, i64)
+declare i32 @memcmp(i8 addrspace(1)* nocapture, i8 addrspace(1)* nocapture, i64)
 
-define i32 @memcmp_const_size_update_deref(i8 addrspace(1)* nocapture readonly %d, i8* nocapture readonly %s) {
+define i32 @memcmp_const_size_update_deref(i8 addrspace(1)* nocapture readonly %d, i8 addrspace(1)* nocapture readonly %s) {
 ; CHECK-LABEL: @memcmp_const_size_update_deref(
-; CHECK-NEXT:    [[CALL:%.*]] = tail call i32 @memcmp(i8 addrspace(1)* noundef dereferenceable(16) dereferenceable_or_null(40) [[D:%.*]], i8* noundef nonnull dereferenceable(16) [[S:%.*]], i64 16)
+; CHECK-NEXT:    [[CALL:%.*]] = tail call i32 @memcmp(i8 addrspace(1)* noundef dereferenceable(16) dereferenceable_or_null(40) [[D:%.*]], i8 addrspace(1)* noundef dereferenceable(16) [[S:%.*]], i64 16)
 ; CHECK-NEXT:    ret i32 [[CALL]]
 ;
-  %call = tail call i32 @memcmp(i8 addrspace(1)* dereferenceable_or_null(40) %d, i8* %s, i64 16)
+  %call = tail call i32 @memcmp(i8 addrspace(1)* dereferenceable_or_null(40) %d, i8 addrspace(1)* %s, i64 16)
   ret i32 %call
 }
 
-define i32 @memcmp_nonconst_size_nonnnull(i8 addrspace(1)* nocapture readonly %d, i8* nocapture readonly %s, i64 %n) {
+define i32 @memcmp_nonconst_size_nonnnull(i8 addrspace(1)* nocapture readonly %d, i8 addrspace(1)* nocapture readonly %s, i64 %n) {
 ; CHECK-LABEL: @memcmp_nonconst_size_nonnnull(
-; CHECK-NEXT:    [[CALL:%.*]] = tail call i32 @memcmp(i8 addrspace(1)* nonnull dereferenceable_or_null(40) [[D:%.*]], i8* nonnull [[S:%.*]], i64 [[N:%.*]])
+; CHECK-NEXT:    [[CALL:%.*]] = tail call i32 @memcmp(i8 addrspace(1)* nonnull dereferenceable_or_null(40) [[D:%.*]], i8 addrspace(1)* nonnull [[S:%.*]], i64 [[N:%.*]])
 ; CHECK-NEXT:    ret i32 [[CALL]]
 ;
-  %call = tail call i32 @memcmp(i8 addrspace(1)* nonnull dereferenceable_or_null(40) %d, i8* nonnull %s, i64 %n)
+  %call = tail call i32 @memcmp(i8 addrspace(1)* nonnull dereferenceable_or_null(40) %d, i8 addrspace(1)* nonnull %s, i64 %n)
   ret i32 %call
 }

diff  --git a/llvm/test/Transforms/InstCombine/mem-deref-bytes.ll b/llvm/test/Transforms/InstCombine/mem-deref-bytes.ll
index 680ff2dd9a76d..8d11b40235ca3 100644
--- a/llvm/test/Transforms/InstCombine/mem-deref-bytes.ll
+++ b/llvm/test/Transforms/InstCombine/mem-deref-bytes.ll
@@ -4,7 +4,7 @@
 declare i32 @memcmp(i8* nocapture, i8* nocapture, i64)
 declare i8* @memcpy(i8* nocapture, i8* nocapture, i64)
 declare i8* @memmove(i8* nocapture, i8* nocapture, i64)
-declare i8* @memset(i8* nocapture, i8, i64)
+declare i8* @memset(i8* nocapture, i32, i64)
 declare i8* @memchr(i8* nocapture, i32, i64)
 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1)
 declare void @llvm.memmove.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1)
@@ -118,12 +118,13 @@ define i8* @memmove_const_size_set_deref(i8* nocapture readonly %d, i8* nocaptur
   ret i8* %call
 }
 
-define i8* @memset_const_size_set_deref(i8* nocapture readonly %s, i8 %c) {
+define i8* @memset_const_size_set_deref(i8* nocapture readonly %s, i32 %c) {
 ; CHECK-LABEL: @memset_const_size_set_deref(
-; CHECK-NEXT:    tail call void @llvm.memset.p0i8.i64(i8* noundef nonnull align 1 dereferenceable(64) [[S:%.*]], i8 [[C:%.*]], i64 64, i1 false)
+; CHECK-NEXT:    [[TMP1:%.*]] = trunc i32 [[C:%.*]] to i8
+; CHECK-NEXT:    tail call void @llvm.memset.p0i8.i64(i8* noundef nonnull align 1 dereferenceable(64) [[S:%.*]], i8 [[TMP1]], i64 64, i1 false)
 ; CHECK-NEXT:    ret i8* [[S]]
 ;
-  %call = tail call i8* @memset(i8* %s, i8 %c, i64 64)
+  %call = tail call i8* @memset(i8* %s, i32 %c, i64 64)
   ret i8* %call
 }
 

diff  --git a/llvm/test/Transforms/InstCombine/new-delete-itanium-32.ll b/llvm/test/Transforms/InstCombine/new-delete-itanium-32.ll
new file mode 100644
index 0000000000000..64d09c1cf0d79
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/new-delete-itanium-32.ll
@@ -0,0 +1,100 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -passes=instcombine -S | FileCheck %s
+
+; Set pointer (and size_t) size to 32 bits.  This lets the declarations
+; below and calls to them be recognized as special.
+
+target datalayout = "p:32:32"
+
+%size_t = type i32
+%align_val_t = type %size_t
+%nothrow_t = type { }
+
+
+; operator new(size_t = unsigned int)
+declare i8* @_Znwj(%size_t)
+
+; operator new[](size_t = unsigned int)
+declare i8* @_Znaj(%size_t)
+
+; operator new(size_t = unsigned int, std::align_val_t)
+declare i8* @_ZnwjSt11align_val_t(%size_t, %size_t)
+
+; operator new[](size_t = unsigned int, std::align_val_t)
+declare i8* @_ZnajSt11align_val_t(%size_t, %size_t)
+
+; operator new(size_t = unsigned int, std::align_val_t, const std::nothrow_t&)
+declare i8* @_ZnwjSt11align_val_tRKSt9nothrow_t(%size_t, %size_t, %nothrow_t*)
+
+; operator new[](size_t = unsigned int, std::align_val_t, const std::nothrow_t&)
+declare i8* @_ZnajSt11align_val_tRKSt9nothrow_t(%size_t, %size_t, %nothrow_t*)
+
+
+; operator delete(void*, size_t = unsigned int)
+declare void @_ZdlPvj(i8*, %size_t)
+
+; operator delete[](void*, size_t = unsigned int)
+declare void @_ZdaPvj(i8*, %size_t)
+
+; operator delete(void*, std::align_val_t)
+declare void @_ZdlPvSt11align_val_t(i8*, %align_val_t)
+
+; operator delete[](void*, std::align_val_t)
+declare void @_ZdaPvSt11align_val_t(i8*, %align_val_t)
+
+; operator delete(void*, size_t = unsigned int, std::align_val_t)
+declare void @_ZdlPvjSt11align_val_t(i8*, %size_t, %align_val_t)
+
+; operator delete[](void*, size_t = unsigned int, std::align_val_t)
+declare void @_ZdaPvjSt11align_val_t(i8*, %size_t, %align_val_t)
+
+; operator delete(void*, std::align_val_t, const std::nothrow_t&)
+declare void @_ZdlPvSt11align_val_tRKSt9nothrow_t(i8*, %align_val_t, %nothrow_t*)
+
+; operator delete[](void*, std::align_val_t, const std::nothrow_t&)
+declare void @_ZdaPvSt11align_val_tRKSt9nothrow_t(i8*, %align_val_t, %nothrow_t*)
+
+declare void @llvm.assume(i1)
+
+
+; Verify that pairs of matching calls to new/delete are eliminated.
+
+define void @elim_new_delete_pairs() {
+; CHECK-LABEL: @elim_new_delete_pairs(
+; CHECK-NEXT:    ret void
+;
+  %nt = alloca %nothrow_t
+
+  %nwj = call i8* @_Znwj(%size_t 32)
+  call void @_ZdlPvj(i8* %nwj, %size_t 32)
+
+  %naj = call i8* @_Znaj(%size_t 32)
+  call void @_ZdaPvj(i8* %naj, %size_t 32)
+
+  %nwja = call i8* @_ZnwjSt11align_val_t(%size_t 32, %size_t 8)
+  call void @_ZdlPvSt11align_val_t(i8* %nwja, %size_t 8)
+
+  %naja = call i8* @_ZnajSt11align_val_t(%size_t 32, %size_t 8)
+  call void @_ZdaPvSt11align_val_t(i8* %naja, i32 8)
+
+  %nwjat = call i8* @_ZnwjSt11align_val_tRKSt9nothrow_t(%size_t 32, %size_t 8, %nothrow_t* %nt)
+  call void @_ZdlPvSt11align_val_tRKSt9nothrow_t(i8* %nwjat, %size_t 8, %nothrow_t* %nt)
+
+  %najat = call i8* @_ZnajSt11align_val_tRKSt9nothrow_t(%size_t 32, %size_t 8, %nothrow_t* %nt)
+  call void @_ZdaPvSt11align_val_tRKSt9nothrow_t(i8* %najat, i32 8, %nothrow_t* %nt)
+
+  %nwja2 = call i8* @_ZnwjSt11align_val_t(%size_t 32, %size_t 8)
+  call void @_ZdlPvjSt11align_val_t(i8* %nwja2, %size_t 32, %size_t 8)
+
+  %naja2 = call i8* @_ZnajSt11align_val_t(%size_t 32, %size_t 8)
+  call void @_ZdaPvjSt11align_val_t(i8* %naja2, %size_t 32, %size_t 8)
+
+  ; Check that the alignment assume does not prevent the removal.
+  %nwa3 = call i8* @_ZnajSt11align_val_t(%size_t 32, %size_t 16)
+
+  call void @llvm.assume(i1 true) [ "align"(i8* %nwa3, i32 16) ]
+
+  call void @_ZdaPvjSt11align_val_t(i8* %nwa3, %size_t 32, %size_t 16)
+
+  ret void
+}

diff  --git a/llvm/test/Transforms/InstCombine/new-delete-itanium.ll b/llvm/test/Transforms/InstCombine/new-delete-itanium.ll
index e10a2de3f4bde..1d13b0bffdd18 100644
--- a/llvm/test/Transforms/InstCombine/new-delete-itanium.ll
+++ b/llvm/test/Transforms/InstCombine/new-delete-itanium.ll
@@ -111,16 +111,12 @@ define linkonce void @_ZdaPvj(i8* %p, i32) nobuiltin {
 
 ; new(size_t, align_val_t)
 declare i8* @_ZnwmSt11align_val_t(i64, i64) nobuiltin
-declare i8* @_ZnwjSt11align_val_t(i32, i32) nobuiltin
 ; new[](size_t, align_val_t)
 declare i8* @_ZnamSt11align_val_t(i64, i64) nobuiltin
-declare i8* @_ZnajSt11align_val_t(i32, i32) nobuiltin
 ; new(size_t, align_val_t, nothrow)
 declare i8* @_ZnwmSt11align_val_tRKSt9nothrow_t(i64, i64, i8*) nobuiltin
-declare i8* @_ZnwjSt11align_val_tRKSt9nothrow_t(i32, i32, i8*) nobuiltin
 ; new[](size_t, align_val_t, nothrow)
 declare i8* @_ZnamSt11align_val_tRKSt9nothrow_t(i64, i64, i8*) nobuiltin
-declare i8* @_ZnajSt11align_val_tRKSt9nothrow_t(i32, i32, i8*) nobuiltin
 ; delete(void*, align_val_t)
 declare void @_ZdlPvSt11align_val_t(i8*, i64) nobuiltin
 ; delete[](void*, align_val_t)
@@ -129,12 +125,8 @@ declare void @_ZdaPvSt11align_val_t(i8*, i64) nobuiltin
 declare void @_ZdlPvSt11align_val_tRKSt9nothrow_t(i8*, i64, i8*) nobuiltin
 ; delete[](void*, align_val_t, nothrow)
 declare void @_ZdaPvSt11align_val_tRKSt9nothrow_t(i8*, i64, i8*) nobuiltin
-; delete(void*, unsigned int, align_val_t)
-declare void @_ZdlPvjSt11align_val_t(i8*, i32, i32) nobuiltin
 ; delete(void*, unsigned long, align_val_t)
 declare void @_ZdlPvmSt11align_val_t(i8*, i64, i64) nobuiltin
-; delete[](void*, unsigned int, align_val_t)
-declare void @_ZdaPvjSt11align_val_t(i8*, i32, i32) nobuiltin
 ; delete[](void*, unsigned long, align_val_t)
 declare void @_ZdaPvmSt11align_val_t(i8*, i64, i64) nobuiltin
 
@@ -151,36 +143,20 @@ define void @test8() {
   call void @_ZdaPv(i8* %na) builtin
   %nwm = call i8* @_Znwm(i64 32) builtin
   call void @_ZdlPvm(i8* %nwm, i64 32) builtin
-  %nwj = call i8* @_Znwj(i32 32) builtin
-  call void @_ZdlPvj(i8* %nwj, i32 32) builtin
   %nam = call i8* @_Znam(i64 32) builtin
   call void @_ZdaPvm(i8* %nam, i64 32) builtin
-  %naj = call i8* @_Znaj(i32 32) builtin
-  call void @_ZdaPvj(i8* %naj, i32 32) builtin
   %nwa = call i8* @_ZnwmSt11align_val_t(i64 32, i64 8) builtin
   call void @_ZdlPvSt11align_val_t(i8* %nwa, i64 8) builtin
   %naa = call i8* @_ZnamSt11align_val_t(i64 32, i64 8) builtin
   call void @_ZdaPvSt11align_val_t(i8* %naa, i64 8) builtin
-  %nwja = call i8* @_ZnwjSt11align_val_t(i32 32, i32 8) builtin
-  call void @_ZdlPvSt11align_val_t(i8* %nwja, i64 8) builtin
-  %naja = call i8* @_ZnajSt11align_val_t(i32 32, i32 8) builtin
-  call void @_ZdaPvSt11align_val_t(i8* %naja, i64 8) builtin
   %nwat = call i8* @_ZnwmSt11align_val_tRKSt9nothrow_t(i64 32, i64 8, i8* %nt) builtin
   call void @_ZdlPvSt11align_val_tRKSt9nothrow_t(i8* %nwat, i64 8, i8* %nt) builtin
   %naat = call i8* @_ZnamSt11align_val_tRKSt9nothrow_t(i64 32, i64 8, i8* %nt) builtin
   call void @_ZdaPvSt11align_val_tRKSt9nothrow_t(i8* %naat, i64 8, i8* %nt) builtin
-  %nwjat = call i8* @_ZnwjSt11align_val_tRKSt9nothrow_t(i32 32, i32 8, i8* %nt) builtin
-  call void @_ZdlPvSt11align_val_tRKSt9nothrow_t(i8* %nwjat, i64 8, i8* %nt) builtin
-  %najat = call i8* @_ZnajSt11align_val_tRKSt9nothrow_t(i32 32, i32 8, i8* %nt) builtin
-  call void @_ZdaPvSt11align_val_tRKSt9nothrow_t(i8* %najat, i64 8, i8* %nt) builtin
   %nwa2 = call i8* @_ZnwmSt11align_val_t(i64 32, i64 8) builtin
   call void @_ZdlPvmSt11align_val_t(i8* %nwa2, i64 32, i64 8) builtin
-  %nwja2 = call i8* @_ZnwjSt11align_val_t(i32 32, i32 8) builtin
-  call void @_ZdlPvjSt11align_val_t(i8* %nwa2, i32 32, i32 8) builtin
   %naa2 = call i8* @_ZnamSt11align_val_t(i64 32, i64 8) builtin
   call void @_ZdaPvmSt11align_val_t(i8* %naa2, i64 32, i64 8) builtin
-  %naja2 = call i8* @_ZnajSt11align_val_t(i32 32, i32 8) builtin
-  call void @_ZdaPvjSt11align_val_t(i8* %naja2, i32 32, i32 8) builtin
 
   ; Check that the alignment assume does not prevent the removal.
   %nwa3 = call i8* @_ZnwmSt11align_val_t(i64 32, i64 16) builtin

diff  --git a/llvm/test/Transforms/InstCombine/printf-2.ll b/llvm/test/Transforms/InstCombine/printf-2.ll
index 31f036d8e5837..209051b071243 100644
--- a/llvm/test/Transforms/InstCombine/printf-2.ll
+++ b/llvm/test/Transforms/InstCombine/printf-2.ll
@@ -12,7 +12,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
 @charstr = constant [2 x i8] c"a\00"
 @empty = constant [1 x i8] c"\00"
 
-declare void @printf(i8*, ...)
+declare i32 @printf(i8*, ...)
 
 ; Check simplification of printf with void return type.
 
@@ -33,7 +33,7 @@ define void @test_simplify1() {
 ; CHECK-NEXT:    ret void
 ;
   %fmt = getelementptr [2 x i8], [2 x i8]* @h, i32 0, i32 0
-  call void (i8*, ...) @printf(i8* %fmt)
+  call i32 (i8*, ...) @printf(i8* %fmt)
   ret void
 }
 
@@ -43,7 +43,7 @@ define void @test_simplify2() {
 ; CHECK-NEXT:    ret void
 ;
   %fmt = getelementptr [13 x i8], [13 x i8]* @hello_world, i32 0, i32 0
-  call void (i8*, ...) @printf(i8* %fmt)
+  call i32 (i8*, ...) @printf(i8* %fmt)
   ret void
 }
 
@@ -54,7 +54,7 @@ define void @test_simplify6() {
 ;
   %fmt = getelementptr [4 x i8], [4 x i8]* @percent_s, i32 0, i32 0
   %str = getelementptr [13 x i8], [13 x i8]* @hello_world, i32 0, i32 0
-  call void (i8*, ...) @printf(i8* %fmt, i8* %str)
+  call i32 (i8*, ...) @printf(i8* %fmt, i8* %str)
   ret void
 }
 
@@ -65,7 +65,7 @@ define void @test_simplify7() {
 ;
   %fmt = getelementptr [3 x i8], [3 x i8]* @format_str, i32 0, i32 0
   %str = getelementptr [2 x i8], [2 x i8]* @charstr, i32 0, i32 0
-  call void (i8*, ...) @printf(i8* %fmt, i8* %str)
+  call i32 (i8*, ...) @printf(i8* %fmt, i8* %str)
   ret void
 }
 
@@ -77,7 +77,7 @@ define void @test_simplify8() {
 ;
   %fmt = getelementptr [3 x i8], [3 x i8]* @format_str, i32 0, i32 0
   %str = getelementptr [1 x i8], [1 x i8]* @empty, i32 0, i32 0
-  call void (i8*, ...) @printf(i8* %fmt, i8* %str)
+  call i32 (i8*, ...) @printf(i8* %fmt, i8* %str)
   ret void
 }
 
@@ -90,7 +90,7 @@ define void @test_simplify9() {
 ;
   %fmt = getelementptr [3 x i8], [3 x i8]* @format_str, i32 0, i32 0
   %str = getelementptr [13 x i8], [13 x i8]* @hello_world, i32 0, i32 0
-  call void (i8*, ...) @printf(i8* %fmt, i8* %str)
+  call i32 (i8*, ...) @printf(i8* %fmt, i8* %str)
   ret void
 }
 
@@ -106,11 +106,11 @@ define void @test_simplify10() {
 ;
   %fmt = getelementptr [3 x i8], [3 x i8]* @format_str, i32 0, i32 0
   %str1 = getelementptr [1 x i8], [1 x i8]* @empty, i32 0, i32 0
-  call void (i8*, ...) @printf(i8* %fmt, i8* %str1, i32 42, double 0x40091EB860000000)
+  call i32 (i8*, ...) @printf(i8* %fmt, i8* %str1, i32 42, double 0x40091EB860000000)
   %str2 = getelementptr [2 x i8], [2 x i8]* @charstr, i32 0, i32 0
-  call void (i8*, ...) @printf(i8* %fmt, i8* %str2, i32 42, double 0x40091EB860000000)
+  call i32 (i8*, ...) @printf(i8* %fmt, i8* %str2, i32 42, double 0x40091EB860000000)
   %str3 = getelementptr [13 x i8], [13 x i8]* @hello_world, i32 0, i32 0
-  call void (i8*, ...) @printf(i8* %fmt, i8* %str3, i32 42, double 0x40091EB860000000)
+  call i32 (i8*, ...) @printf(i8* %fmt, i8* %str3, i32 42, double 0x40091EB860000000)
   ret void
 }
 ;.

diff  --git a/llvm/test/Transforms/InstCombine/simplify-libcalls-i16.ll b/llvm/test/Transforms/InstCombine/simplify-libcalls-i16.ll
new file mode 100644
index 0000000000000..d5553095fdace
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/simplify-libcalls-i16.ll
@@ -0,0 +1,340 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S < %s -mtriple=unknown -passes=instcombine -instcombine-infinite-loop-threshold=2 | FileCheck -check-prefixes=CHECK,CHECK32 %s
+; RUN: opt -S < %s -mtriple=msp430 -passes=instcombine -instcombine-infinite-loop-threshold=2 | FileCheck -check-prefixes=CHECK,CHECK16 %s
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S32"
+
+ at G = constant [3 x i8] c"%s\00"		; <[3 x i8]*> [#uses=1]
+
+; A 16-bit compatible sprintf is not recognized as the standard library
+; function on 32-bit targets.
+declare i16 @sprintf(i8*, i8*, ...)
+
+define void @foo(i8* %P, i32* %X) {
+; CHECK32-LABEL: @foo(
+; CHECK32-NEXT:    [[TMP1:%.*]] = call i16 (i8*, i8*, ...) @sprintf(i8* [[P:%.*]], i8* getelementptr inbounds ([3 x i8], [3 x i8]* @G, i32 0, i32 0), i32* [[X:%.*]])
+; CHECK32-NEXT:    ret void
+;
+; CHECK16-LABEL: @foo(
+; CHECK16-NEXT:    [[CSTR:%.*]] = bitcast i32* [[X:%.*]] to i8*
+; CHECK16-NEXT:    [[STRCPY:%.*]] = call i8* @strcpy(i8* noundef nonnull dereferenceable(1) [[P:%.*]], i8* noundef nonnull dereferenceable(1) [[CSTR]])
+; CHECK16-NEXT:    ret void
+;
+  call i16 (i8*, i8*, ...) @sprintf(i8* %P, i8* getelementptr ([3 x i8], [3 x i8]* @G, i32 0, i32 0), i32* %X )		; <i32>:1 [#uses=0]
+  ret void
+}
+
+; PR1307
+ at str = internal constant [5 x i8] c"foog\00"
+ at str1 = internal constant [8 x i8] c"blahhh!\00"
+ at str2 = internal constant [5 x i8] c"Ponk\00"
+
+define i8* @test1() {
+; CHECK32-LABEL: @test1(
+; CHECK32-NEXT:    [[TMP3:%.*]] = tail call i8* @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str, i32 0, i32 2), i16 103)
+; CHECK32-NEXT:    ret i8* [[TMP3]]
+;
+; CHECK16-LABEL: @test1(
+; CHECK16-NEXT:    ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str, i32 0, i32 3)
+;
+  %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8], [5 x i8]* @str, i32 0, i16 2), i16 103 )              ; <i8*> [#uses=1]
+  ret i8* %tmp3
+}
+
+; A 16-bit compatible strchr is not recognized as the standard library
+; function on 32-bit targets.
+declare i8* @strchr(i8*, i16)
+
+define i8* @test2() {
+; CHECK32-LABEL: @test2(
+; CHECK32-NEXT:    [[TMP3:%.*]] = tail call i8* @strchr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str1, i32 0, i32 2), i16 0)
+; CHECK32-NEXT:    ret i8* [[TMP3]]
+;
+; CHECK16-LABEL: @test2(
+; CHECK16-NEXT:    ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str1, i32 0, i32 7)
+;
+  %tmp3 = tail call i8* @strchr( i8* getelementptr ([8 x i8], [8 x i8]* @str1, i32 0, i32 2), i16 0 )               ; <i8*> [#uses=1]
+  ret i8* %tmp3
+}
+
+define i8* @test3() {
+; CHECK32-LABEL: @test3(
+; CHECK32-NEXT:  entry:
+; CHECK32-NEXT:    [[TMP3:%.*]] = tail call i8* @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str2, i32 0, i32 1), i16 80)
+; CHECK32-NEXT:    ret i8* [[TMP3]]
+;
+; CHECK16-LABEL: @test3(
+; CHECK16-NEXT:  entry:
+; CHECK16-NEXT:    ret i8* null
+;
+entry:
+  %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8], [5 x i8]* @str2, i32 0, i32 1), i16 80 )              ; <i8*> [#uses=1]
+  ret i8* %tmp3
+
+}
+
+ at _2E_str = external constant [5 x i8]		; <[5 x i8]*> [#uses=1]
+
+; A 16-bit compatible memcmp is not recognized as the standard library
+; function on 32-bit targets.
+declare i16 @memcmp(i8*, i8*, i16) nounwind readonly
+
+define i1 @PR2341(i8** %start_addr) {
+; CHECK-LABEL: @PR2341(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[TMP4:%.*]] = load i8*, i8** [[START_ADDR:%.*]], align 4
+; CHECK-NEXT:    [[TMP5:%.*]] = call i16 @memcmp(i8* [[TMP4]], i8* getelementptr inbounds ([5 x i8], [5 x i8]* @_2E_str, i32 0, i32 0), i16 4) #[[ATTR0:[0-9]+]]
+; CHECK-NEXT:    [[TMP6:%.*]] = icmp eq i16 [[TMP5]], 0
+; CHECK-NEXT:    ret i1 [[TMP6]]
+;
+entry:
+  %tmp4 = load i8*, i8** %start_addr, align 4		; <i8*> [#uses=1]
+  %tmp5 = call i16 @memcmp( i8* %tmp4, i8* getelementptr ([5 x i8], [5 x i8]* @_2E_str, i32 0, i32 0), i16 4 ) nounwind readonly 		; <i32> [#uses=1]
+  %tmp6 = icmp eq i16 %tmp5, 0		; <i1> [#uses=1]
+  ret i1 %tmp6
+
+}
+
+define i16 @PR4284() nounwind {
+; CHECK-LABEL: @PR4284(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[C0:%.*]] = alloca i8, align 1
+; CHECK-NEXT:    [[C2:%.*]] = alloca i8, align 1
+; CHECK-NEXT:    store i8 64, i8* [[C0]], align 1
+; CHECK-NEXT:    store i8 -127, i8* [[C2]], align 1
+; CHECK-NEXT:    [[CALL:%.*]] = call i16 @memcmp(i8* nonnull [[C0]], i8* nonnull [[C2]], i16 1)
+; CHECK-NEXT:    ret i16 [[CALL]]
+;
+entry:
+  %c0 = alloca i8, align 1		; <i8*> [#uses=2]
+  %c2 = alloca i8, align 1		; <i8*> [#uses=2]
+  store i8 64, i8* %c0
+  store i8 -127, i8* %c2
+  %call = call i16 @memcmp(i8* %c0, i8* %c2, i16 1)		; <i32> [#uses=1]
+  ret i16 %call
+
+}
+
+%struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, i8*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64, %struct.pthread_mutex*, %struct.pthread*, i32, i32, %union.anon }
+%struct.__sbuf = type { i8*, i32, [4 x i8] }
+%struct.pthread = type opaque
+%struct.pthread_mutex = type opaque
+%union.anon = type { i64, [120 x i8] }
+ at .str13 = external constant [2 x i8]		; <[2 x i8]*> [#uses=1]
+ at .str14 = external constant [2 x i8]		; <[2 x i8]*> [#uses=1]
+
+define i32 @PR4641(i32 %argc, i8** %argv, i1 %c1, i8* %ptr) nounwind {
+; CHECK-LABEL: @PR4641(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    call void @exit(i16 0) #[[ATTR1:[0-9]+]]
+; CHECK-NEXT:    [[COND392:%.*]] = select i1 [[C1:%.*]], i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str13, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str14, i32 0, i32 0)
+; CHECK-NEXT:    [[CALL393:%.*]] = call %struct.__sFILE* @fopen(i8* [[PTR:%.*]], i8* [[COND392]]) #[[ATTR1]]
+; CHECK-NEXT:    unreachable
+;
+entry:
+  call void @exit(i16 0) nounwind
+  %cond392 = select i1 %c1, i8* getelementptr ([2 x i8], [2 x i8]* @.str13, i32 0, i32 0), i8* getelementptr ([2 x i8], [2 x i8]* @.str14, i32 0, i32 0)		; <i8*> [#uses=1]
+  %call393 = call %struct.__sFILE* @fopen(i8* %ptr, i8* %cond392) nounwind		; <%struct.__sFILE*> [#uses=0]
+  unreachable
+}
+
+declare %struct.__sFILE* @fopen(i8*, i8*)
+
+; A 16-bit compatible exit is not recognized as the standard library
+; function on 32-bit targets.
+declare void @exit(i16)
+
+define i32 @PR4645(i1 %c1) {
+; CHECK-LABEL: @PR4645(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    br label [[IF_THEN:%.*]]
+; CHECK:       lor.lhs.false:
+; CHECK-NEXT:    br i1 [[C1:%.*]], label [[IF_THEN]], label [[FOR_COND:%.*]]
+; CHECK:       if.then:
+; CHECK-NEXT:    call void @exit(i16 1)
+; CHECK-NEXT:    br label [[FOR_COND]]
+; CHECK:       for.cond:
+; CHECK-NEXT:    unreachable
+; CHECK:       for.end:
+; CHECK-NEXT:    br label [[FOR_COND]]
+;
+entry:
+  br label %if.then
+
+lor.lhs.false:		; preds = %while.body
+  br i1 %c1, label %if.then, label %for.cond
+
+if.then:		; preds = %lor.lhs.false, %while.body
+  call void @exit(i16 1)
+  br label %for.cond
+
+for.cond:		; preds = %for.end, %if.then, %lor.lhs.false
+  %j.0 = phi i32 [ %inc47, %for.end ], [ 0, %if.then ], [ 0, %lor.lhs.false ]		; <i32> [#uses=1]
+  unreachable
+
+for.end:		; preds = %for.cond20
+  %inc47 = add i32 %j.0, 1		; <i32> [#uses=1]
+  br label %for.cond
+}
+
+ at h = constant [2 x i8] c"h\00"		; <[2 x i8]*> [#uses=1]
+ at hel = constant [4 x i8] c"hel\00"		; <[4 x i8]*> [#uses=1]
+ at hello_u = constant [8 x i8] c"hello_u\00"		; <[8 x i8]*> [#uses=1]
+
+define i32 @MemCpy() {
+; CHECK-LABEL: @MemCpy(
+; CHECK-NEXT:    ret i32 0
+;
+  %h_p = getelementptr [2 x i8], [2 x i8]* @h, i32 0, i32 0
+  %hel_p = getelementptr [4 x i8], [4 x i8]* @hel, i32 0, i32 0
+  %hello_u_p = getelementptr [8 x i8], [8 x i8]* @hello_u, i32 0, i32 0
+  %target = alloca [1024 x i8]
+  %target_p = getelementptr [1024 x i8], [1024 x i8]* %target, i32 0, i32 0
+  call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 2 %target_p, i8* align 2 %h_p, i16 2, i1 false)
+  call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %target_p, i8* align 4 %hel_p, i16 4, i1 false)
+  call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %target_p, i8* align 8 %hello_u_p, i16 8, i1 false)
+  ret i32 0
+
+}
+
+declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i16, i1)
+
+; A 16-bit compatible strcmp is not recognized as the standard library
+; function on 32-bit targets.
+declare i16 @strcmp(i8*, i8*) #0
+
+define void @test9(i8* %x) {
+; CHECK32-LABEL: @test9(
+; CHECK32-NEXT:    [[Y:%.*]] = call i16 @strcmp(i8* [[X:%.*]], i8* [[X]]) #[[ATTR5:[0-9]+]]
+; CHECK32-NEXT:    ret void
+;
+; CHECK16-LABEL: @test9(
+; CHECK16-NEXT:    ret void
+;
+  %y = call i16 @strcmp(i8* %x, i8* %x) #1
+  ret void
+}
+
+; PR30484 - https://llvm.org/bugs/show_bug.cgi?id=30484
+; These aren't the library functions you're looking for...
+
+declare i32 @isdigit(i8)
+declare i32 @isascii(i8)
+declare i32 @toascii(i8)
+
+define i32 @fake_isdigit(i8 %x) {
+; CHECK-LABEL: @fake_isdigit(
+; CHECK-NEXT:    [[Y:%.*]] = call i32 @isdigit(i8 [[X:%.*]])
+; CHECK-NEXT:    ret i32 [[Y]]
+;
+  %y = call i32 @isdigit(i8 %x)
+  ret i32 %y
+}
+
+define i32 @fake_isascii(i8 %x) {
+; CHECK-LABEL: @fake_isascii(
+; CHECK-NEXT:    [[Y:%.*]] = call i32 @isascii(i8 [[X:%.*]])
+; CHECK-NEXT:    ret i32 [[Y]]
+;
+  %y = call i32 @isascii(i8 %x)
+  ret i32 %y
+}
+
+define i32 @fake_toascii(i8 %x) {
+; CHECK-LABEL: @fake_toascii(
+; CHECK-NEXT:    [[Y:%.*]] = call i32 @toascii(i8 [[X:%.*]])
+; CHECK-NEXT:    ret i32 [[Y]]
+;
+  %y = call i32 @toascii(i8 %x)
+  ret i32 %y
+}
+
+declare double @pow(double, double)
+declare double @exp2(double)
+
+; check to make sure only the correct libcall attributes are used
+define double @fake_exp2(double %x) {
+; CHECK-LABEL: @fake_exp2(
+; CHECK-NEXT:    [[EXP2:%.*]] = call double @exp2(double [[X:%.*]])
+; CHECK-NEXT:    ret double [[EXP2]]
+;
+
+  %y = call inreg double @pow(double inreg 2.0, double inreg %x)
+  ret double %y
+}
+define double @fake_ldexp(i32 %x) {
+; CHECK32-LABEL: @fake_ldexp(
+; CHECK32-NEXT:    [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[X:%.*]])
+; CHECK32-NEXT:    ret double [[LDEXP]]
+;
+; CHECK16-LABEL: @fake_ldexp(
+; CHECK16-NEXT:    [[Y:%.*]] = sitofp i32 [[X:%.*]] to double
+; CHECK16-NEXT:    [[Z:%.*]] = call inreg double @exp2(double [[Y]])
+; CHECK16-NEXT:    ret double [[Z]]
+;
+
+
+  %y = sitofp i32 %x to double
+  %z = call inreg double @exp2(double %y)
+  ret double %z
+}
+define double @fake_ldexp_16(i16 %x) {
+; CHECK32-LABEL: @fake_ldexp_16(
+; CHECK32-NEXT:    [[TMP1:%.*]] = sext i16 [[X:%.*]] to i32
+; CHECK32-NEXT:    [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]])
+; CHECK32-NEXT:    ret double [[LDEXP]]
+;
+; CHECK16-LABEL: @fake_ldexp_16(
+; CHECK16-NEXT:    [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 [[X:%.*]])
+; CHECK16-NEXT:    ret double [[LDEXP]]
+;
+
+
+  %y = sitofp i16 %x to double
+  %z = call inreg double @exp2(double %y)
+  ret double %z
+}
+
+; PR50885 - this would crash in ValueTracking.
+
+; A 16-bit compatible snprintf is not recognized as the standard library
+; function on 32-bit targets.
+declare i16 @snprintf(i8*, double, i32*)
+
+define i16 @fake_snprintf(i32 %buf, double %len, i32 * %str, i8* %ptr) {
+; CHECK-LABEL: @fake_snprintf(
+; CHECK-NEXT:    [[CALL:%.*]] = call i16 @snprintf(i8* [[PTR:%.*]], double [[LEN:%.*]], i32* [[STR:%.*]])
+; CHECK-NEXT:    ret i16 [[CALL]]
+;
+  %call = call i16 @snprintf(i8* %ptr, double %len, i32* %str)
+  ret i16 %call
+}
+
+; Wrong return type for the real strlen.
+; https://llvm.org/PR50836
+
+define i4 @strlen(i8* %s) {
+; CHECK-LABEL: @strlen(
+; CHECK-NEXT:    [[R:%.*]] = call i4 @strlen(i8* [[S:%.*]])
+; CHECK-NEXT:    ret i4 0
+;
+  %r = call i4 @strlen(i8* %s)
+  ret i4 0
+}
+
+; Test emission of stpncpy.
+ at a = dso_local global [4 x i8] c"123\00"
+ at b = dso_local global [5 x i8] zeroinitializer
+declare i8* @__stpncpy_chk(i8* noundef, i8* noundef, i32 noundef, i32 noundef)
+define signext i32 @emit_stpncpy() {
+; CHECK-LABEL: @emit_stpncpy(
+; CHECK-NEXT:    [[STPNCPY:%.*]] = call i8* @stpncpy(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @b, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @a, i32 0, i32 0), i32 2)
+; CHECK-NEXT:    ret i32 0
+;
+  %call = call i8* @__stpncpy_chk(i8* noundef getelementptr inbounds ([5 x i8], [5 x i8]* @b, i32 0, i32 0),
+  i8* noundef getelementptr inbounds ([4 x i8], [4 x i8]* @a, i32 0, i32 0),
+  i32 noundef 2, i32 noundef 5)
+  ret i32 0
+}
+
+attributes #0 = { nobuiltin }
+attributes #1 = { builtin }

diff  --git a/llvm/test/Transforms/InstCombine/simplify-libcalls.ll b/llvm/test/Transforms/InstCombine/simplify-libcalls.ll
index 2964d6c29d7bd..2ee085c31ef1c 100644
--- a/llvm/test/Transforms/InstCombine/simplify-libcalls.ll
+++ b/llvm/test/Transforms/InstCombine/simplify-libcalls.ll
@@ -5,13 +5,19 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
 
 @G = constant [3 x i8] c"%s\00"		; <[3 x i8]*> [#uses=1]
 
+; A 32-bit compatible sprintf is not recognized as the standard library
+; function on 16-bit targets.
 declare i32 @sprintf(i8*, i8*, ...)
 
 define void @foo(i8* %P, i32* %X) {
-; CHECK-LABEL: @foo(
-; CHECK-NEXT:    [[CSTR:%.*]] = bitcast i32* [[X:%.*]] to i8*
-; CHECK-NEXT:    [[STRCPY:%.*]] = call i8* @strcpy(i8* noundef nonnull dereferenceable(1) [[P:%.*]], i8* noundef nonnull dereferenceable(1) [[CSTR]])
-; CHECK-NEXT:    ret void
+; CHECK32-LABEL: @foo(
+; CHECK32-NEXT:    [[CSTR:%.*]] = bitcast i32* [[X:%.*]] to i8*
+; CHECK32-NEXT:    [[STRCPY:%.*]] = call i8* @strcpy(i8* noundef nonnull dereferenceable(1) [[P:%.*]], i8* noundef nonnull dereferenceable(1) [[CSTR]])
+; CHECK32-NEXT:    ret void
+;
+; CHECK16-LABEL: @foo(
+; CHECK16-NEXT:    [[TMP1:%.*]] = call i32 (i8*, i8*, ...) @sprintf(i8* [[P:%.*]], i8* getelementptr inbounds ([3 x i8], [3 x i8]* @G, i32 0, i32 0), i32* [[X:%.*]])
+; CHECK16-NEXT:    ret void
 ;
   call i32 (i8*, i8*, ...) @sprintf( i8* %P, i8* getelementptr ([3 x i8], [3 x i8]* @G, i32 0, i32 0), i32* %X )		; <i32>:1 [#uses=0]
   ret void
@@ -23,27 +29,42 @@ define void @foo(i8* %P, i32* %X) {
 @str2 = internal constant [5 x i8] c"Ponk\00"
 
 define i8* @test1() {
-; CHECK-LABEL: @test1(
-; CHECK-NEXT:    ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str, i32 0, i32 3)
+; CHECK32-LABEL: @test1(
+; CHECK32-NEXT:    ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str, i32 0, i32 3)
+;
+; CHECK16-LABEL: @test1(
+; CHECK16-NEXT:    [[TMP3:%.*]] = tail call i8* @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str, i32 0, i32 2), i32 103)
+; CHECK16-NEXT:    ret i8* [[TMP3]]
 ;
   %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8], [5 x i8]* @str, i32 0, i32 2), i32 103 )              ; <i8*> [#uses=1]
   ret i8* %tmp3
 }
 
+; A 32-bit compatible strchr is not recognized as the standard library
+; function on 16-bit targets.
 declare i8* @strchr(i8*, i32)
 
 define i8* @test2() {
-; CHECK-LABEL: @test2(
-; CHECK-NEXT:    ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str1, i32 0, i32 7)
+; CHECK32-LABEL: @test2(
+; CHECK32-NEXT:    ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str1, i32 0, i32 7)
+;
+; CHECK16-LABEL: @test2(
+; CHECK16-NEXT:    [[TMP3:%.*]] = tail call i8* @strchr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str1, i32 0, i32 2), i32 0)
+; CHECK16-NEXT:    ret i8* [[TMP3]]
 ;
   %tmp3 = tail call i8* @strchr( i8* getelementptr ([8 x i8], [8 x i8]* @str1, i32 0, i32 2), i32 0 )               ; <i8*> [#uses=1]
   ret i8* %tmp3
 }
 
 define i8* @test3() {
-; CHECK-LABEL: @test3(
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    ret i8* null
+; CHECK32-LABEL: @test3(
+; CHECK32-NEXT:  entry:
+; CHECK32-NEXT:    ret i8* null
+;
+; CHECK16-LABEL: @test3(
+; CHECK16-NEXT:  entry:
+; CHECK16-NEXT:    [[TMP3:%.*]] = tail call i8* @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str2, i32 0, i32 1), i32 80)
+; CHECK16-NEXT:    ret i8* [[TMP3]]
 ;
 entry:
   %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8], [5 x i8]* @str2, i32 0, i32 1), i32 80 )              ; <i8*> [#uses=1]
@@ -53,15 +74,24 @@ entry:
 
 @_2E_str = external constant [5 x i8]		; <[5 x i8]*> [#uses=1]
 
+; A 32-bit compatible memcmp is not recognized as the standard library
+; function on 16-bit targets.
 declare i32 @memcmp(i8*, i8*, i32) nounwind readonly
 
 define i1 @PR2341(i8** %start_addr) {
-; CHECK-LABEL: @PR2341(
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[TMP4:%.*]] = load i8*, i8** [[START_ADDR:%.*]], align 4
-; CHECK-NEXT:    [[TMP5:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) [[TMP4]], i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([5 x i8], [5 x i8]* @_2E_str, i32 0, i32 0), i32 4) #[[ATTR0:[0-9]+]]
-; CHECK-NEXT:    [[TMP6:%.*]] = icmp eq i32 [[TMP5]], 0
-; CHECK-NEXT:    ret i1 [[TMP6]]
+; CHECK32-LABEL: @PR2341(
+; CHECK32-NEXT:  entry:
+; CHECK32-NEXT:    [[TMP4:%.*]] = load i8*, i8** [[START_ADDR:%.*]], align 4
+; CHECK32-NEXT:    [[TMP5:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) [[TMP4]], i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([5 x i8], [5 x i8]* @_2E_str, i32 0, i32 0), i32 4) #[[ATTR0:[0-9]+]]
+; CHECK32-NEXT:    [[TMP6:%.*]] = icmp eq i32 [[TMP5]], 0
+; CHECK32-NEXT:    ret i1 [[TMP6]]
+;
+; CHECK16-LABEL: @PR2341(
+; CHECK16-NEXT:  entry:
+; CHECK16-NEXT:    [[TMP4:%.*]] = load i8*, i8** [[START_ADDR:%.*]], align 4
+; CHECK16-NEXT:    [[TMP5:%.*]] = call i32 @memcmp(i8* [[TMP4]], i8* getelementptr inbounds ([5 x i8], [5 x i8]* @_2E_str, i32 0, i32 0), i32 4) #[[ATTR0:[0-9]+]]
+; CHECK16-NEXT:    [[TMP6:%.*]] = icmp eq i32 [[TMP5]], 0
+; CHECK16-NEXT:    ret i1 [[TMP6]]
 ;
 entry:
   %tmp4 = load i8*, i8** %start_addr, align 4		; <i8*> [#uses=1]
@@ -72,9 +102,18 @@ entry:
 }
 
 define i32 @PR4284() nounwind {
-; CHECK-LABEL: @PR4284(
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    ret i32 -65
+; CHECK32-LABEL: @PR4284(
+; CHECK32-NEXT:  entry:
+; CHECK32-NEXT:    ret i32 -65
+;
+; CHECK16-LABEL: @PR4284(
+; CHECK16-NEXT:  entry:
+; CHECK16-NEXT:    [[C0:%.*]] = alloca i8, align 1
+; CHECK16-NEXT:    [[C2:%.*]] = alloca i8, align 1
+; CHECK16-NEXT:    store i8 64, i8* [[C0]], align 1
+; CHECK16-NEXT:    store i8 -127, i8* [[C2]], align 1
+; CHECK16-NEXT:    [[CALL:%.*]] = call i32 @memcmp(i8* nonnull [[C0]], i8* nonnull [[C2]], i32 1)
+; CHECK16-NEXT:    ret i32 [[CALL]]
 ;
 entry:
   %c0 = alloca i8, align 1		; <i8*> [#uses=2]
@@ -111,6 +150,8 @@ entry:
 
 declare %struct.__sFILE* @fopen(i8*, i8*)
 
+; A 32-bit compatible exit is not recognized as the standard library
+; function on 16-bit targets.
 declare void @exit(i32)
 
 define i32 @PR4645(i1 %c1) {
@@ -168,11 +209,17 @@ define i32 @MemCpy() {
 
 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind
 
+; A 32-bit compatible strcmp is not recognized as the standard library
+; function on 16-bit targets.
 declare i32 @strcmp(i8*, i8*) #0
 
 define void @test9(i8* %x) {
-; CHECK-LABEL: @test9(
-; CHECK-NEXT:    ret void
+; CHECK32-LABEL: @test9(
+; CHECK32-NEXT:    ret void
+;
+; CHECK16-LABEL: @test9(
+; CHECK16-NEXT:    [[Y:%.*]] = call i32 @strcmp(i8* [[X:%.*]], i8* [[X]]) #[[ATTR5:[0-9]+]]
+; CHECK16-NEXT:    ret void
 ;
   %y = call i32 @strcmp(i8* %x, i8* %x) #1
   ret void
@@ -260,6 +307,8 @@ define double @fake_ldexp_16(i16 %x) {
 
 ; PR50885 - this would crash in ValueTracking.
 
+; A 32-bit compatible snprintf is not recognized as the standard library
+; function on 16-bit targets.
 declare i32 @snprintf(i8*, double, i32*)
 
 define i32 @fake_snprintf(i32 %buf, double %len, i32 * %str, i8* %ptr) {

diff  --git a/llvm/test/Transforms/InstCombine/sprintf-3.ll b/llvm/test/Transforms/InstCombine/sprintf-3.ll
new file mode 100644
index 0000000000000..aa883f8f949d5
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/sprintf-3.ll
@@ -0,0 +1,19 @@
+; Regression test for PR51200.
+;
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -passes=instcombine -S | FileCheck %s
+;
+; This transformation requires the pointer size, as it assumes that size_t is
+; the size of a pointer.
+
+ at percent_s = constant [3 x i8] c"%s\00"
+
+declare i32 @sprintf(i8**, i32*, ...)
+
+define i32 @PR51200(i8** %p, i32* %p2) {
+; CHECK-LABEL: @PR51200(
+; Don't check anything, just expect the test to compile successfully.
+;
+  %call = call i32 (i8**, i32*, ...) @sprintf(i8** %p, i32* bitcast ([3 x i8]* @percent_s to i32*), i32* %p2)
+  ret i32 %call
+}

diff  --git a/llvm/test/Transforms/InstCombine/sqrt-nofast.ll b/llvm/test/Transforms/InstCombine/sqrt-nofast.ll
index af805197b7394..ba101d7bae0a9 100644
--- a/llvm/test/Transforms/InstCombine/sqrt-nofast.ll
+++ b/llvm/test/Transforms/InstCombine/sqrt-nofast.ll
@@ -25,19 +25,20 @@ entry:
 
 declare float @llvm.sqrt.f32(float) #1
 
-; FIXME:
-; This is a function called "sqrtf", but its type is double.
-; Assume it is a user function rather than a libm function,
-; so don't transform it.
+; The call below is to a function called "sqrtf", but its type is double.
+; Assume it is a user function rather than a libm function, and so don't
+; transform it.
 
 define double @fake_sqrt(double %a, double %b) {
 ; CHECK-LABEL: @fake_sqrt(
-; CHECK-NEXT:    [[FABS:%.*]] = call fast double @llvm.fabs.f64(double [[A:%.*]])
-; CHECK-NEXT:    ret double [[FABS]]
+; CHECK-NEXT:    [[C:%.*]] = fmul fast double [[A:%.*]], [[A]]
+; CHECK-NEXT:    [[E:%.*]] = call fast double @sqrtf(double [[C]]) #[[ATTR1:[0-9]+]]
+; CHECK-NEXT:    ret double [[E]]
 ;
   %c = fmul fast double %a, %a
   %e = call fast double @sqrtf(double %c) readnone
   ret double %e
 }
 
-declare double @sqrtf(double) readnone ; This is not the 'sqrt' you're looking for.
+; Standard sqrtf takes and returns float.  The following is not it.
+declare double @sqrtf(double) readnone

diff  --git a/llvm/test/Transforms/InstCombine/stdiocall-bad-sig.ll b/llvm/test/Transforms/InstCombine/stdiocall-bad-sig.ll
new file mode 100644
index 0000000000000..3fb279335ca85
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/stdiocall-bad-sig.ll
@@ -0,0 +1,62 @@
+; Verify that calls to known stdio library functions declared with
+; incompatible signatures are handled gracefully and without aborting.
+;
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -passes=instcombine -opaque-pointers -S | FileCheck %s
+
+declare i32 @fwrite(i8*, i64, i64, ptr)
+declare i8 @fputc(ptr, ptr)
+
+declare void @printf(ptr)
+declare i8 @fprintf(ptr, ptr)
+declare i8 @sprintf(ptr, ptr)
+
+
+ at ca1 = constant [1 x i8] c"1"
+ at pcnt_s = constant [3 x i8] c"%s\00"
+
+
+; Verify that a call to fwrite isn't transformed into one to fputc when
+; the latter is declared with an incompatible signature (which might
+; trigger an abort).
+
+define void @call_fwrite(ptr %fp) {
+  %p = getelementptr [1 x i8], ptr @ca1, i32 0, i32 0
+  call i32 @fwrite(ptr %p, i64 1, i64 1, ptr %fp)
+  ret void
+}
+
+
+; Verify that a call to an incompatible void printf(char*) with just "%s"
+; isn't transformed.
+
+define void @call_printf(ptr %s) {
+; CHECK-LABEL: @call_printf(
+;
+  %fmt = getelementptr [3 x i8], ptr @pcnt_s, i32 0, i32 0
+  call i32 @printf(ptr %fmt)
+  ret void
+}
+
+; Verify that a call to an incompatible int fprintf(FILE*, char*) isn't
+; transformed.
+
+define i8 @call_fprintf(ptr %fp, ptr %p) {
+; CHECK-LABEL: @call_fprintf(
+;
+  %fmt = getelementptr [3 x i8], ptr @pcnt_s, i32 0, i32 0
+  %call = call i8 (ptr, ptr, ...) @fprintf(ptr %fp, ptr %fmt, ptr %p)
+  ret i8 %call
+}
+
+; Verify that a call to an incompatible int sprintf(FILE*, char*) isn't
+; transformed.
+
+define i8 @call_sprintf(ptr %p, ptr %q) {
+; CHECK-LABEL: @call_sprintf(
+;
+  %fmt = getelementptr [3 x i8], ptr @pcnt_s, i32 0, i32 0
+  %call = call i8 (ptr, ptr, ...) @sprintf(ptr %p, ptr %fmt, ptr %q)
+  ret i8 %call
+}
+

diff  --git a/llvm/test/Transforms/InstCombine/stpcpy-1.ll b/llvm/test/Transforms/InstCombine/stpcpy-1.ll
index 791cbdf737ff9..184435ecdb678 100644
--- a/llvm/test/Transforms/InstCombine/stpcpy-1.ll
+++ b/llvm/test/Transforms/InstCombine/stpcpy-1.ll
@@ -11,7 +11,6 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
 @b = common global [32 x i8] zeroinitializer, align 1
 @percent_s = constant [3 x i8] c"%s\00"
 
-declare i32 @sprintf(i8**, i32*, ...)
 declare i8* @stpcpy(i8*, i8*)
 
 define i8* @test_simplify1() {
@@ -76,21 +75,3 @@ define i8* @test_no_incompatible_attr() {
   %ret = call dereferenceable(1) i8* @stpcpy(i8* %dst, i8* %src)
   ret i8* %ret
 }
-
-; The libcall prototype checker does not check for exact pointer type
-; (just pointer of some type), so we identify this as a standard sprintf
-; call. This requires a cast to operate on mismatched pointer types.
-
-define i32 @PR51200(i8** %p, i32* %p2) {
-; CHECK-LABEL: @PR51200(
-; CHECK-NEXT:    [[CSTR:%.*]] = bitcast i8** [[P:%.*]] to i8*
-; CHECK-NEXT:    [[CSTR1:%.*]] = bitcast i32* [[P2:%.*]] to i8*
-; CHECK-NEXT:    [[STPCPY:%.*]] = call i8* @stpcpy(i8* [[CSTR]], i8* [[CSTR1]])
-; CHECK-NEXT:    [[TMP1:%.*]] = ptrtoint i8* [[STPCPY]] to i32
-; CHECK-NEXT:    [[TMP2:%.*]] = ptrtoint i8** [[P]] to i32
-; CHECK-NEXT:    [[TMP3:%.*]] = sub i32 [[TMP1]], [[TMP2]]
-; CHECK-NEXT:    ret i32 [[TMP3]]
-;
-  %call = call i32 (i8**, i32*, ...) @sprintf(i8** %p, i32* bitcast ([3 x i8]* @percent_s to i32*), i32* %p2)
-  ret i32 %call
-}

diff  --git a/llvm/test/Transforms/InstCombine/stpcpy-2.ll b/llvm/test/Transforms/InstCombine/stpcpy-2.ll
index 3ef1958194476..b36e34ac783a2 100644
--- a/llvm/test/Transforms/InstCombine/stpcpy-2.ll
+++ b/llvm/test/Transforms/InstCombine/stpcpy-2.ll
@@ -8,7 +8,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
 @hello = constant [6 x i8] c"hello\00"
 @a = common global [32 x i8] zeroinitializer, align 1
 
-declare i16* @stpcpy(i8*, i8*)
+declare i16 @stpcpy(i8*, i8*)
 
 define void @test_no_simplify1() {
 ; CHECK-LABEL: @test_no_simplify1(
@@ -16,7 +16,7 @@ define void @test_no_simplify1() {
   %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
   %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
 
-  call i16* @stpcpy(i8* %dst, i8* %src)
-; CHECK: call i16* @stpcpy
+  call i16 @stpcpy(i8* %dst, i8* %src)
+; CHECK: call i16 @stpcpy
   ret void
 }

diff  --git a/llvm/test/Transforms/InstCombine/stpcpy_chk-2.ll b/llvm/test/Transforms/InstCombine/stpcpy_chk-2.ll
index 9bf038042e294..0705dde20de2d 100644
--- a/llvm/test/Transforms/InstCombine/stpcpy_chk-2.ll
+++ b/llvm/test/Transforms/InstCombine/stpcpy_chk-2.ll
@@ -13,9 +13,9 @@ define void @test_no_simplify() {
   %dst = getelementptr inbounds [60 x i16], [60 x i16]* @a, i32 0, i32 0
   %src = getelementptr inbounds [8 x i8], [8 x i8]* @.str, i32 0, i32 0
 
-; CHECK-NEXT: call i16* @__strcpy_chk
-  call i16* @__strcpy_chk(i16* %dst, i8* %src, i32 8)
+; CHECK-NEXT: call i16 @__strcpy_chk
+  call i16 @__strcpy_chk(i16* %dst, i8* %src, i32 8)
   ret void
 }
 
-declare i16* @__strcpy_chk(i16*, i8*, i32)
+declare i16 @__strcpy_chk(i16*, i8*, i32)

diff  --git a/llvm/test/Transforms/InstCombine/str-int.ll b/llvm/test/Transforms/InstCombine/str-int.ll
index fb30ccc73e5fc..c3d1fe045fe94 100644
--- a/llvm/test/Transforms/InstCombine/str-int.ll
+++ b/llvm/test/Transforms/InstCombine/str-int.ll
@@ -13,8 +13,8 @@
 declare i32 @strtol(i8*, i8**, i32)
 declare i32 @atoi(i8*)
 declare i32 @atol(i8*)
-declare i32 @atoll(i8*)
-declare i32 @strtoll(i8*, i8**, i32)
+declare i64 @atoll(i8*)
+declare i64 @strtoll(i8*, i8**, i32)
 
 define i32 @strtol_dec() #0 {
 ; CHECK-LABEL: @strtol_dec(
@@ -128,21 +128,19 @@ define i32 @atol_test() #0 {
   ret i32 %call
 }
 
-define i32 @atoll_test() #0 {
+define i64 @atoll_test() #0 {
 ; CHECK-LABEL: @atoll_test(
-; CHECK-NEXT:    [[CALL:%.*]] = call i32 @atoll(i8* nocapture getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
-; CHECK-NEXT:    ret i32 [[CALL]]
+; CHECK-NEXT:    ret i64 4994967295
 ;
-  %call = call i32 @atoll(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i32 0, i32 0)) #3
-  ret i32 %call
+  %call = call i64 @atoll(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i32 0, i32 0)) #3
+  ret i64 %call
 }
 
-define i32 @strtoll_test() #0 {
+define i64 @strtoll_test() #0 {
 ; CHECK-LABEL: @strtoll_test(
-; CHECK-NEXT:    [[CALL:%.*]] = call i32 @strtoll(i8* nocapture getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8** null, i32 10)
-; CHECK-NEXT:    ret i32 [[CALL]]
+; CHECK-NEXT:    ret i64 4994967295
 ;
 ; CHECK-NEXT
-  %call = call i32 @strtoll(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i32 0, i32 0), i8** null, i32 10) #5
-  ret i32 %call
+  %call = call i64 @strtoll(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i32 0, i32 0), i8** null, i32 10) #5
+  ret i64 %call
 }

diff  --git a/llvm/test/Transforms/InstCombine/strcall-bad-sig.ll b/llvm/test/Transforms/InstCombine/strcall-bad-sig.ll
new file mode 100644
index 0000000000000..c842084f106f3
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/strcall-bad-sig.ll
@@ -0,0 +1,166 @@
+; Verify that calls to known string library functions declared with
+; incompatible signatures are handled gracefully and without aborting.
+;
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -passes=instcombine -opaque-pointers -S | FileCheck %s
+
+ at a = constant [2 x i8] c"1\00"
+
+declare ptr @atoi(ptr)
+declare ptr @atol(ptr)
+declare ptr @atoll(ptr)
+
+define void @call_bad_ato(ptr %ps) {
+; CHECK-LABEL: @call_bad_ato(
+; CHECK-NEXT:    [[IR:%.*]] = call ptr @atoi(ptr nonnull @a)
+; CHECK-NEXT:    store ptr [[IR]], ptr [[PS:%.*]], align 8
+; CHECK-NEXT:    [[LR:%.*]] = call ptr @atol(ptr nonnull @a)
+; CHECK-NEXT:    [[PS1:%.*]] = getelementptr ptr, ptr [[PS]], i64 1
+; CHECK-NEXT:    store ptr [[LR]], ptr [[PS1]], align 8
+; CHECK-NEXT:    [[LLR:%.*]] = call ptr @atol(ptr nonnull @a)
+; CHECK-NEXT:    [[PS2:%.*]] = getelementptr ptr, ptr [[PS]], i64 2
+; CHECK-NEXT:    store ptr [[LLR]], ptr [[PS2]], align 8
+; CHECK-NEXT:    ret void
+;
+  %p = getelementptr [2 x i8], [2 x i8]* @a, i32 0, i32 0
+
+  %ir = call ptr @atoi(ptr %p)
+  %ps0 = getelementptr ptr, ptr %ps, i32 0
+  store ptr %ir, ptr %ps0
+
+  %lr = call ptr @atol(ptr %p)
+  %ps1 = getelementptr ptr, ptr %ps, i32 1
+  store ptr %lr, ptr %ps1
+
+  %llr = call ptr @atol(ptr %p)
+  %ps2 = getelementptr ptr, ptr %ps, i32 2
+  store ptr %llr, ptr %ps2
+
+  ret void
+}
+
+
+declare ptr @strncasecmp(ptr, ptr)
+
+define ptr @call_bad_strncasecmp() {
+; CHECK-LABEL: @call_bad_strncasecmp(
+; CHECK-NEXT:    [[CMP:%.*]] = call ptr @strncasecmp(ptr nonnull @a, ptr getelementptr inbounds ([2 x i8], ptr @a, i64 0, i64 1))
+; CHECK-NEXT:    ret ptr [[CMP]]
+;
+  %p0 = getelementptr [2 x i8], [2 x i8]* @a, i32 0, i32 0
+  %p1 = getelementptr [2 x i8], [2 x i8]* @a, i32 0, i32 1
+  %cmp = call ptr @strncasecmp(ptr %p0, ptr %p1)
+  ret ptr %cmp
+}
+
+
+declare i1 @strcoll(ptr, ptr, ptr)
+
+define i1 @call_bad_strcoll() {
+; CHECK-LABEL: @call_bad_strcoll(
+; CHECK-NEXT:    [[I:%.*]] = call i1 @strcoll(ptr nonnull @a, ptr getelementptr inbounds ([2 x i8], ptr @a, i64 0, i64 1), ptr nonnull @a)
+; CHECK-NEXT:    ret i1 [[I]]
+;
+  %p0 = getelementptr [2 x i8], [2 x i8]* @a, i32 0, i32 0
+  %p1 = getelementptr [2 x i8], [2 x i8]* @a, i32 0, i32 1
+  %i = call i1 @strcoll(ptr %p0, ptr %p1, ptr %p0)
+  ret i1 %i
+}
+
+
+declare ptr @strndup(ptr)
+
+define ptr @call_bad_strndup() {
+; CHECK-LABEL: @call_bad_strndup(
+; CHECK-NEXT:    [[D:%.*]] = call ptr @strndup(ptr nonnull @a)
+; CHECK-NEXT:    ret ptr [[D]]
+;
+  %p = getelementptr [2 x i8], [2 x i8]* @a, i32 0, i32 0
+  %d = call ptr @strndup(ptr %p)
+  ret ptr %d
+}
+
+
+declare i1 @strtok(ptr, ptr, i1)
+
+define i1 @call_bad_strtok() {
+; CHECK-LABEL: @call_bad_strtok(
+; CHECK-NEXT:    [[RET:%.*]] = call i1 @strtok(ptr nonnull @a, ptr getelementptr inbounds ([2 x i8], ptr @a, i64 0, i64 1), i1 false)
+; CHECK-NEXT:    ret i1 [[RET]]
+;
+  %p0 = getelementptr [2 x i8], [2 x i8]* @a, i32 0, i32 0
+  %p1 = getelementptr [2 x i8], [2 x i8]* @a, i32 0, i32 1
+  %ret = call i1 @strtok(ptr %p0, ptr %p1, i1 0)
+  ret i1 %ret
+}
+
+
+
+declare i1 @strtok_r(ptr, ptr)
+
+define i1 @call_bad_strtok_r() {
+; CHECK-LABEL: @call_bad_strtok_r(
+; CHECK-NEXT:    [[RET:%.*]] = call i1 @strtok_r(ptr nonnull @a, ptr getelementptr inbounds ([2 x i8], ptr @a, i64 0, i64 1))
+; CHECK-NEXT:    ret i1 [[RET]]
+;
+  %p0 = getelementptr [2 x i8], [2 x i8]* @a, i32 0, i32 0
+  %p1 = getelementptr [2 x i8], [2 x i8]* @a, i32 0, i32 1
+  %ret = call i1 @strtok_r(ptr %p0, ptr %p1)
+  ret i1 %ret
+}
+
+
+declare i32 @strtol(ptr, ptr)
+declare i32 @strtoul(ptr, ptr)
+
+declare i64 @strtoll(ptr, ptr)
+declare i64 @strtoull(ptr, ptr)
+
+define void @call_bad_strto(i32* %psi32, i64* %psi64) {
+; CHECK-LABEL: @call_bad_strto(
+; CHECK-NEXT:    [[LR:%.*]] = call i32 @strtol(ptr nonnull @a, ptr null)
+; CHECK-NEXT:    store i32 [[LR]], ptr [[PSI32:%.*]], align 4
+; CHECK-NEXT:    [[ULR:%.*]] = call i32 @strtoul(ptr nonnull @a, ptr null)
+; CHECK-NEXT:    [[PS1:%.*]] = getelementptr i32, ptr [[PSI32]], i64 1
+; CHECK-NEXT:    store i32 [[ULR]], ptr [[PS1]], align 4
+; CHECK-NEXT:    [[LLR:%.*]] = call i64 @strtoll(ptr nonnull @a, ptr null)
+; CHECK-NEXT:    store i64 [[LLR]], ptr [[PSI64:%.*]], align 4
+; CHECK-NEXT:    [[ULLR:%.*]] = call i64 @strtoull(ptr nonnull @a, ptr null)
+; CHECK-NEXT:    [[PS3:%.*]] = getelementptr i64, ptr [[PSI64]], i64 3
+; CHECK-NEXT:    store i64 [[ULLR]], ptr [[PS3]], align 4
+; CHECK-NEXT:    ret void
+;
+  %p = getelementptr [2 x i8], [2 x i8]* @a, i32 0, i32 0
+
+  %lr = call i32 @strtol(ptr %p, ptr null)
+  %ps0 = getelementptr i32, i32* %psi32, i32 0
+  store i32 %lr, i32* %ps0
+
+  %ulr = call i32 @strtoul(ptr %p, ptr null)
+  %ps1 = getelementptr i32, i32* %psi32, i32 1
+  store i32 %ulr, i32* %ps1
+
+  %llr = call i64 @strtoll(ptr %p, ptr null)
+  %ps2 = getelementptr i64, i64* %psi64, i32 0
+  store i64 %llr, i64* %ps2
+
+  %ullr = call i64 @strtoull(ptr %p, ptr null)
+  %ps3 = getelementptr i64, i64* %psi64, i32 3
+  store i64 %ullr, i64* %ps3
+
+  ret void
+}
+
+
+declare ptr @strxfrm(ptr, ptr)
+
+define ptr @call_bad_strxfrm() {
+; CHECK-LABEL: @call_bad_strxfrm(
+; CHECK-NEXT:    [[RET:%.*]] = call ptr @strxfrm(ptr nonnull @a, ptr getelementptr inbounds ([2 x i8], ptr @a, i64 0, i64 1))
+; CHECK-NEXT:    ret ptr [[RET]]
+;
+  %p0 = getelementptr [2 x i8], [2 x i8]* @a, i32 0, i32 0
+  %p1 = getelementptr [2 x i8], [2 x i8]* @a, i32 0, i32 1
+  %ret = call ptr @strxfrm(ptr %p0, ptr %p1)
+  ret ptr %ret
+}

diff  --git a/llvm/test/Transforms/InstCombine/strcat-3.ll b/llvm/test/Transforms/InstCombine/strcat-3.ll
index b40d8c190318b..1de78e5268f90 100644
--- a/llvm/test/Transforms/InstCombine/strcat-3.ll
+++ b/llvm/test/Transforms/InstCombine/strcat-3.ll
@@ -1,4 +1,5 @@
-; Test that the strcat libcall simplifier works correctly.
+; Test that the strcat folder avoids simplifying a call to the function
+; declared with an incompatible type.
 ;
 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
 
@@ -8,15 +9,16 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
 @empty = constant [1 x i8] c"\00"
 @a = common global [32 x i8] zeroinitializer, align 1
 
-declare i16* @strcat(i8*, i8*)
+; Expected type: i8* @strcat(i8*, i8*).
+declare i16 @strcat(i8*, i8*)
 
 define void @test_nosimplify1() {
 ; CHECK-LABEL: @test_nosimplify1(
-; CHECK: call i16* @strcat
+; CHECK: call i16 @strcat
 ; CHECK: ret void
 
   %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
   %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
-  call i16* @strcat(i8* %dst, i8* %src)
+  call i16 @strcat(i8* %dst, i8* %src)
   ret void
 }

diff  --git a/llvm/test/Transforms/InstCombine/strcpy-2.ll b/llvm/test/Transforms/InstCombine/strcpy-2.ll
index bdd05db67eab5..f67dd426a6326 100644
--- a/llvm/test/Transforms/InstCombine/strcpy-2.ll
+++ b/llvm/test/Transforms/InstCombine/strcpy-2.ll
@@ -1,4 +1,6 @@
-; Test that the strcpy library call simplifier works correctly.
+; Test that the strcpy folder avoids simplifying a call to the function
+; declared with an incompatible type.
+;
 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
 ;
 ; This transformation requires the pointer size, as it assumes that size_t is
@@ -8,7 +10,8 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
 @hello = constant [6 x i8] c"hello\00"
 @a = common global [32 x i8] zeroinitializer, align 1
 
-declare i16* @strcpy(i8*, i8*)
+; Expected type: i8* @strcpy(i8*, i8*)
+declare i16 @strcpy(i8*, i8*)
 
 define void @test_no_simplify1() {
 ; CHECK-LABEL: @test_no_simplify1(
@@ -16,7 +19,7 @@ define void @test_no_simplify1() {
   %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
   %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
 
-  call i16* @strcpy(i8* %dst, i8* %src)
-; CHECK: call i16* @strcpy
+  call i16 @strcpy(i8* %dst, i8* %src)
+; CHECK: call i16 @strcpy
   ret void
 }

diff  --git a/llvm/test/Transforms/InstCombine/strcpy_chk-2.ll b/llvm/test/Transforms/InstCombine/strcpy_chk-2.ll
index bfbf094c7383e..226584839e04c 100644
--- a/llvm/test/Transforms/InstCombine/strcpy_chk-2.ll
+++ b/llvm/test/Transforms/InstCombine/strcpy_chk-2.ll
@@ -13,9 +13,9 @@ define void @test_no_simplify() {
   %dst = getelementptr inbounds [60 x i16], [60 x i16]* @a, i32 0, i32 0
   %src = getelementptr inbounds [8 x i8], [8 x i8]* @.str, i32 0, i32 0
 
-; CHECK-NEXT: call i16* @__strcpy_chk
-  call i16* @__strcpy_chk(i16* %dst, i8* %src, i32 8)
+; CHECK-NEXT: call i16 @__strcpy_chk
+  call i16 @__strcpy_chk(i16* %dst, i8* %src, i32 8)
   ret void
 }
 
-declare i16* @__strcpy_chk(i16*, i8*, i32)
+declare i16 @__strcpy_chk(i16*, i8*, i32)

diff  --git a/llvm/test/Transforms/InstCombine/strncat-3.ll b/llvm/test/Transforms/InstCombine/strncat-3.ll
index e95acaaabcef7..6b67ab419aef7 100644
--- a/llvm/test/Transforms/InstCombine/strncat-3.ll
+++ b/llvm/test/Transforms/InstCombine/strncat-3.ll
@@ -1,6 +1,7 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; Test that the strncat libcall simplifier works correctly.
+; Test that the strncat folder avoids simplifying a call to the function
+; declared with an incompatible type.
 ;
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
 
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
@@ -9,16 +10,16 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
 @empty = constant [1 x i8] c"\00"
 @a = common global [32 x i8] zeroinitializer, align 1
 
-declare i16* @strncat(i8*, i8*, i32)
+declare i16 @strncat(i8*, i8*, i32)
 
 define void @test_nosimplify1() {
 ; CHECK-LABEL: @test_nosimplify1(
-; CHECK-NEXT:    [[TMP1:%.*]] = call i16* @strncat(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i32 13)
+; CHECK-NEXT:    [[TMP1:%.*]] = call i16 @strncat(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i32 13)
 ; CHECK-NEXT:    ret void
 ;
 
   %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
   %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
-  call i16* @strncat(i8* %dst, i8* %src, i32 13)
+  call i16 @strncat(i8* %dst, i8* %src, i32 13)
   ret void
 }

diff  --git a/llvm/test/Transforms/InstCombine/strncpy-2.ll b/llvm/test/Transforms/InstCombine/strncpy-2.ll
index 4102760e7e9e4..49b07c629026d 100644
--- a/llvm/test/Transforms/InstCombine/strncpy-2.ll
+++ b/llvm/test/Transforms/InstCombine/strncpy-2.ll
@@ -1,3 +1,6 @@
+; Test that the strncpy folder avoids simplifying a call to the function
+; declared with an incompatible type.
+;
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; Test that the strncpy library call simplifier works correctly.
 ;
@@ -8,18 +11,18 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
 @hello = constant [6 x i8] c"hello\00"
 @a = common global [32 x i8] zeroinitializer, align 1
 
-declare i16* @strncpy(i8*, i8*, i32)
+declare i16 @strncpy(i8*, i8*, i32)
 
 ; Check that 'strncpy' functions with the wrong prototype aren't simplified.
 
 define void @test_no_simplify1() {
 ; CHECK-LABEL: @test_no_simplify1(
-; CHECK-NEXT:    [[TMP1:%.*]] = call i16* @strncpy(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i32 6)
+; CHECK-NEXT:    [[TMP1:%.*]] = call i16 @strncpy(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i32 6)
 ; CHECK-NEXT:    ret void
 ;
   %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
   %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
 
-  call i16* @strncpy(i8* %dst, i8* %src, i32 6)
+  call i16 @strncpy(i8* %dst, i8* %src, i32 6)
   ret void
 }

diff  --git a/llvm/test/Transforms/InstCombine/strncpy_chk-2.ll b/llvm/test/Transforms/InstCombine/strncpy_chk-2.ll
index cc49e2a898bfb..0016dc08a96b6 100644
--- a/llvm/test/Transforms/InstCombine/strncpy_chk-2.ll
+++ b/llvm/test/Transforms/InstCombine/strncpy_chk-2.ll
@@ -13,9 +13,9 @@ define void @test_no_simplify() {
   %dst = getelementptr inbounds [60 x i16], [60 x i16]* @a, i32 0, i32 0
   %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
 
-; CHECK-NEXT: call i16* @__strncpy_chk
-  call i16* @__strncpy_chk(i16* %dst, i8* %src, i32 60, i32 60)
+; CHECK-NEXT: call i16 @__strncpy_chk
+  call i16 @__strncpy_chk(i16* %dst, i8* %src, i32 60, i32 60)
   ret void
 }
 
-declare i16* @__strncpy_chk(i16*, i8*, i32, i32)
+declare i16 @__strncpy_chk(i16*, i8*, i32, i32)

diff  --git a/llvm/test/Transforms/InstCombine/strndup.ll b/llvm/test/Transforms/InstCombine/strndup.ll
index bab37a2118b78..9b74e0c269eac 100644
--- a/llvm/test/Transforms/InstCombine/strndup.ll
+++ b/llvm/test/Transforms/InstCombine/strndup.ll
@@ -4,7 +4,7 @@
 @hello = constant [6 x i8] c"hello\00"
 @null = constant [1 x i8] zeroinitializer
 
-declare i8* @strndup(i8*, i32)
+declare i8* @strndup(i8*, i64)
 
 define i8* @test1() {
 ; CHECK-LABEL: @test1(
@@ -12,17 +12,17 @@ define i8* @test1() {
 ; CHECK-NEXT:    ret i8* [[STRDUP]]
 ;
   %src = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
-  %ret = call i8* @strndup(i8* %src, i32 0)
+  %ret = call i8* @strndup(i8* %src, i64 0)
   ret i8* %ret
 }
 
 define i8* @test2() {
 ; CHECK-LABEL: @test2(
-; CHECK-NEXT:    [[RET:%.*]] = call dereferenceable_or_null(5) i8* @strndup(i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i64 0, i64 0), i32 4)
+; CHECK-NEXT:    [[RET:%.*]] = call dereferenceable_or_null(5) i8* @strndup(i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i64 0, i64 0), i64 4)
 ; CHECK-NEXT:    ret i8* [[RET]]
 ;
   %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
-  %ret = call i8* @strndup(i8* %src, i32 4)
+  %ret = call i8* @strndup(i8* %src, i64 4)
   ret i8* %ret
 }
 
@@ -32,7 +32,7 @@ define i8* @test3() {
 ; CHECK-NEXT:    ret i8* [[STRDUP]]
 ;
   %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
-  %ret = call i8* @strndup(i8* %src, i32 5)
+  %ret = call i8* @strndup(i8* %src, i64 5)
   ret i8* %ret
 }
 
@@ -42,7 +42,7 @@ define i8* @test4() {
 ; CHECK-NEXT:    ret i8* [[STRDUP]]
 ;
   %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
-  %ret = call i8* @strndup(i8* %src, i32 6)
+  %ret = call i8* @strndup(i8* %src, i64 6)
   ret i8* %ret
 }
 
@@ -52,16 +52,16 @@ define i8* @test5() {
 ; CHECK-NEXT:    ret i8* [[STRDUP]]
 ;
   %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
-  %ret = call i8* @strndup(i8* %src, i32 7)
+  %ret = call i8* @strndup(i8* %src, i64 7)
   ret i8* %ret
 }
 
-define i8* @test6(i32 %n) {
+define i8* @test6(i64 %n) {
 ; CHECK-LABEL: @test6(
-; CHECK-NEXT:    [[RET:%.*]] = call i8* @strndup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i64 0, i64 0), i32 [[N:%.*]])
+; CHECK-NEXT:    [[RET:%.*]] = call i8* @strndup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i64 0, i64 0), i64 [[N:%.*]])
 ; CHECK-NEXT:    ret i8* [[RET]]
 ;
   %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
-  %ret = call i8* @strndup(i8* %src, i32 %n)
+  %ret = call i8* @strndup(i8* %src, i64 %n)
   ret i8* %ret
 }

diff  --git a/llvm/test/Transforms/InstCombine/strpbrk-2.ll b/llvm/test/Transforms/InstCombine/strpbrk-2.ll
index 4913fb269b1d9..fc1010ff1f08a 100644
--- a/llvm/test/Transforms/InstCombine/strpbrk-2.ll
+++ b/llvm/test/Transforms/InstCombine/strpbrk-2.ll
@@ -1,4 +1,5 @@
-; Test that the strpbrk library call simplifier works correctly.
+; Test that the strpbrk folder doesn't simplify a call to the function
+; declared with an incompatible prototype.
 ;
 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
 
@@ -7,17 +8,17 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
 @hello = constant [12 x i8] c"hello world\00"
 @w = constant [2 x i8] c"w\00"
 
-declare i16* @strpbrk(i8*, i8*)
+declare i8 @strpbrk(i8*, i8*)
 
 ; Check that 'strpbrk' functions with the wrong prototype aren't simplified.
 
-define i16* @test_no_simplify1() {
+define i8 @test_no_simplify1() {
 ; CHECK-LABEL: @test_no_simplify1(
   %str = getelementptr [12 x i8], [12 x i8]* @hello, i32 0, i32 0
   %pat = getelementptr [2 x i8], [2 x i8]* @w, i32 0, i32 0
 
-  %ret = call i16* @strpbrk(i8* %str, i8* %pat)
-; CHECK-NEXT: %ret = call i16* @strpbrk
-  ret i16* %ret
-; CHECK-NEXT: ret i16* %ret
+  %ret = call i8 @strpbrk(i8* %str, i8* %pat)
+; CHECK-NEXT: %ret = call i8 @strpbrk
+  ret i8 %ret
+; CHECK-NEXT: ret i8 %ret
 }

diff  --git a/llvm/test/Transforms/InstCombine/strspn-1.ll b/llvm/test/Transforms/InstCombine/strspn-1.ll
index a593a6cd05556..3b66f33f30761 100644
--- a/llvm/test/Transforms/InstCombine/strspn-1.ll
+++ b/llvm/test/Transforms/InstCombine/strspn-1.ll
@@ -2,8 +2,6 @@
 ;
 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
 
-target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
-
 @abcba = constant [6 x i8] c"abcba\00"
 @abc = constant [4 x i8] c"abc\00"
 @null = constant [1 x i8] zeroinitializer

diff  --git a/llvm/test/Transforms/InstCombine/strto-1.ll b/llvm/test/Transforms/InstCombine/strto-1.ll
index 96f36e8d89c7d..44db69329d4e9 100644
--- a/llvm/test/Transforms/InstCombine/strto-1.ll
+++ b/llvm/test/Transforms/InstCombine/strto-1.ll
@@ -4,14 +4,14 @@
 
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
 
-declare i64 @strtol(i8* %s, i8** %endptr, i32 %base)
-; CHECK: declare i64 @strtol(i8* readonly, i8** nocapture, i32)
+declare i32 @strtol(i8* %s, i8** %endptr, i32 %base)
+; CHECK: declare i32 @strtol(i8* readonly, i8** nocapture, i32)
 
-declare double @strtod(i8* %s, i8** %endptr, i32 %base)
-; CHECK: declare double @strtod(i8* readonly, i8** nocapture, i32)
+declare double @strtod(i8* %s, i8** %endptr)
+; CHECK: declare double @strtod(i8* readonly, i8** nocapture)
 
-declare float @strtof(i8* %s, i8** %endptr, i32 %base)
-; CHECK: declare float @strtof(i8* readonly, i8** nocapture, i32)
+declare float @strtof(i8* %s, i8** %endptr)
+; CHECK: declare float @strtof(i8* readonly, i8** nocapture)
 
 declare i64 @strtoul(i8* %s, i8** %endptr, i32 %base)
 ; CHECK: declare i64 @strtoul(i8* readonly, i8** nocapture, i32)
@@ -27,22 +27,22 @@ declare i64 @strtoull(i8* %s, i8** %endptr, i32 %base)
 
 define void @test_simplify1(i8* %x, i8** %endptr) {
 ; CHECK-LABEL: @test_simplify1(
-  call i64 @strtol(i8* %x, i8** null, i32 10)
-; CHECK-NEXT: call i64 @strtol(i8* nocapture %x, i8** null, i32 10)
+  call i32 @strtol(i8* %x, i8** null, i32 10)
+; CHECK-NEXT: call i32 @strtol(i8* nocapture %x, i8** null, i32 10)
   ret void
 }
 
 define void @test_simplify2(i8* %x, i8** %endptr) {
 ; CHECK-LABEL: @test_simplify2(
-  call double @strtod(i8* %x, i8** null, i32 10)
-; CHECK-NEXT: call double @strtod(i8* nocapture %x, i8** null, i32 10)
+  call double @strtod(i8* %x, i8** null)
+; CHECK-NEXT: call double @strtod(i8* nocapture %x, i8** null)
   ret void
 }
 
 define void @test_simplify3(i8* %x, i8** %endptr) {
 ; CHECK-LABEL: @test_simplify3(
-  call float @strtof(i8* %x, i8** null, i32 10)
-; CHECK-NEXT: call float @strtof(i8* nocapture %x, i8** null, i32 10)
+  call float @strtof(i8* %x, i8** null)
+; CHECK-NEXT: call float @strtof(i8* nocapture %x, i8** null)
   ret void
 }
 
@@ -76,7 +76,7 @@ define void @test_simplify7(i8* %x, i8** %endptr) {
 
 define void @test_no_simplify1(i8* %x, i8** %endptr) {
 ; CHECK-LABEL: @test_no_simplify1(
-  call i64 @strtol(i8* %x, i8** %endptr, i32 10)
-; CHECK-NEXT: call i64 @strtol(i8* %x, i8** %endptr, i32 10)
+  call i32 @strtol(i8* %x, i8** %endptr, i32 10)
+; CHECK-NEXT: call i32 @strtol(i8* %x, i8** %endptr, i32 10)
   ret void
 }

diff  --git a/llvm/test/Transforms/InstSimplify/call.ll b/llvm/test/Transforms/InstSimplify/call.ll
index 243551ec2b9d5..2a775b1430f35 100644
--- a/llvm/test/Transforms/InstSimplify/call.ll
+++ b/llvm/test/Transforms/InstSimplify/call.ll
@@ -286,15 +286,15 @@ define {i8, i1} @test_smul4_poison(i8 %V) {
 }
 
 ; Test a non-intrinsic that we know about as a library call.
-declare float @fabs(float %x)
+declare float @fabsf(float %x)
 
 define float @test_fabs_libcall() {
 ; CHECK-LABEL: @test_fabs_libcall(
-; CHECK-NEXT:    [[X:%.*]] = call float @fabs(float -4.200000e+01)
+; CHECK-NEXT:    [[X:%.*]] = call float @fabsf(float -4.200000e+01)
 ; CHECK-NEXT:    ret float 4.200000e+01
 ;
 
-  %x = call float @fabs(float -42.0)
+  %x = call float @fabsf(float -42.0)
 ; This is still a real function call, so instsimplify won't nuke it -- other
 ; passes have to do that.
 

diff  --git a/llvm/test/Transforms/LoopUnroll/WebAssembly/basic-unrolling.ll b/llvm/test/Transforms/LoopUnroll/WebAssembly/basic-unrolling.ll
index 2ef342b80b929..a898d9e51adcf 100644
--- a/llvm/test/Transforms/LoopUnroll/WebAssembly/basic-unrolling.ll
+++ b/llvm/test/Transforms/LoopUnroll/WebAssembly/basic-unrolling.ll
@@ -203,7 +203,7 @@ define hidden void @dont_unroll_call(i32* nocapture %a, i32* nocapture readonly
 ; CHECK-NEXT:    [[MUL:%.*]] = mul nsw i32 [[I1]], [[I]]
 ; CHECK-NEXT:    [[ARRAYIDX2:%.*]] = getelementptr inbounds i32, i32* [[A:%.*]], i32 [[I_013]]
 ; CHECK-NEXT:    store i32 [[MUL]], i32* [[ARRAYIDX2]], align 4
-; CHECK-NEXT:    call void (i8*, ...) @printf(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 [[I_013]], i32 [[MUL]])
+; CHECK-NEXT:    call i32 (i8*, ...) @printf(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 [[I_013]], i32 [[MUL]])
 ; CHECK-NEXT:    [[INC]] = add nuw i32 [[I_013]], 1
 ; CHECK-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC]], [[N]]
 ; CHECK-NEXT:    br i1 [[EXITCOND_NOT]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]]
@@ -224,7 +224,7 @@ for.body:                                         ; preds = %for.body, %entry
   %mul = mul nsw i32 %i1, %i
   %arrayidx2 = getelementptr inbounds i32, i32* %a, i32 %i.013
   store i32 %mul, i32* %arrayidx2, align 4
-  call void (i8*, ...) @printf(i8* nonnull dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 %i.013, i32 %mul)
+  call i32 (i8*, ...) @printf(i8* nonnull dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 %i.013, i32 %mul)
   %inc = add nuw i32 %i.013, 1
   %exitcond.not = icmp eq i32 %inc, %N
   br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
@@ -300,4 +300,4 @@ attributes #0 = { optsize }
 attributes #1 = { minsize }
 
 @.str = private unnamed_addr constant [12 x i8] c"a[%d] = %d\0A\00", align 1
-declare void @printf(i8* nocapture readonly, ...)
+declare i32 @printf(i8* nocapture readonly, ...)

diff  --git a/llvm/test/Transforms/LoopVectorize/AArch64/extractvalue-no-scalarization-required.ll b/llvm/test/Transforms/LoopVectorize/AArch64/extractvalue-no-scalarization-required.ll
index 14ac57cd8e884..70da6550d7294 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/extractvalue-no-scalarization-required.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/extractvalue-no-scalarization-required.ll
@@ -56,7 +56,7 @@ exit:
 
 
 ; Similar to the test case above, but checks getVectorCallCost as well.
-declare float @pow(float, float) readnone nounwind
+declare float @powf(float, float) readnone nounwind
 
 ; CM: LV: Found uniform instruction:   %a = extractvalue { float, float } %sv, 0
 ; CM: LV: Found uniform instruction:   %b = extractvalue { float, float } %sv, 1
@@ -94,7 +94,7 @@ loop.body:
   %a = extractvalue { float, float } %sv, 0
   %b = extractvalue { float, float } %sv, 1
   %addr = getelementptr float, float* %dst, i32 %iv
-  %p = call float @pow(float %a, float %b)
+  %p = call float @powf(float %a, float %b)
   store float %p, float* %addr
   %iv.next = add nsw i32 %iv, 1
   %cond = icmp ne i32 %iv.next, 0

diff  --git a/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp b/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
index e206dd99be143..261786b304611 100644
--- a/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
+++ b/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
@@ -322,8 +322,8 @@ TEST_F(TargetLibraryInfoTest, ValidProto) {
       "declare i8* @strtok(i8*, i8*)\n"
       "declare i8* @strtok_r(i8*, i8*, i8**)\n"
       "declare i64 @strtol(i8*, i8**, i32)\n"
-      "declare i64 @strlcat(i8*, i8**, i64)\n"
-      "declare i64 @strlcpy(i8*, i8**, i64)\n"
+      "declare i64 @strlcat(i8*, i8*, i64)\n"
+      "declare i64 @strlcpy(i8*, i8*, i64)\n"
       "declare x86_fp80 @strtold(i8*, i8**)\n"
       "declare i64 @strtoll(i8*, i8**, i32)\n"
       "declare i64 @strtoul(i8*, i8**, i32)\n"
@@ -482,7 +482,7 @@ TEST_F(TargetLibraryInfoTest, ValidProto) {
       "declare i8* @__stpncpy_chk(i8*, i8*, i64, i64)\n"
       "declare i8* @__strcpy_chk(i8*, i8*, i64)\n"
       "declare i8* @__strncpy_chk(i8*, i8*, i64, i64)\n"
-      "declare i8* @__memccpy_chk(i8*, i8*, i32, i64)\n"
+      "declare i8* @__memccpy_chk(i8*, i8*, i32, i64, i64)\n"
       "declare i8* @__mempcpy_chk(i8*, i8*, i64, i64)\n"
       "declare i32 @__snprintf_chk(i8*, i64, i32, i64, i8*, ...)\n"
       "declare i32 @__sprintf_chk(i8*, i32, i64, i8*, ...)\n"


        


More information about the llvm-commits mailing list