[BuildLibCalls] Use TLI to get 'int' and 'size_t' type sizes
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Wed, 28 Sep 2022 20:59:39 +0000 (22:59 +0200)
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Tue, 4 Oct 2022 10:52:05 +0000 (12:52 +0200)
commitaa1b64cc425665a529816505eea272927ab6a589
tree5be73c7870d1ca358ea3473308d78132d9c90c79
parent73e8d95d28f8afa6f45cd0830641f62025584c07
[BuildLibCalls] Use TLI to get 'int' and 'size_t' type sizes

Stop assuming that an 'int' is 32 bits in helpers that emit libcalls
to lib functions that had 'int' in the signature. For most targets
this is NFC. For a target with 16 bit 'int' type this could help out
detecting if trying to emit a libcall with incorrect signature.

Similarly we now derive the type mapping to 'size_t' by asking TLI
about the size of 'size_t'. This should be NFC (at least for in-tree
targets) since getSizeTSize(), in TLI, is deriving the size in the
same way as DataLayout::getIntPtrType().

Differential Revision: https://reviews.llvm.org/D135065
llvm/include/llvm/IR/IRBuilder.h
llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
llvm/lib/Transforms/Scalar/MergeICmps.cpp
llvm/lib/Transforms/Utils/BuildLibCalls.cpp
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp