Added a helper in TargetLibraryInfo to get size of "size_t" in bits, given a Module reference. The new getSizeTSize helper is using the same strategy as for example isValidProtoForLibFunc has been using in the past, assuming that the size can be derived by asking DataLayout about the size/type of a pointer to int. FortifiedLibCallSimplifier::optimizeStrpCpyChk was changed to use the new getSizeTSize helper instead of assuming that sizeof(size_t) is equal to sizeof(int*) by itself (that is the assumption used in TargetLibraryInfoImpl::getSizeTSize so the result will be the same). Having a common helper for this ensure that we use the same strategy when deriving the size of "size_t" in different parts of the code. One bonus with this refactoring (basing it on Module instead of just DataLayout) is that it makes it easier to override this for a specific target triple, in case the assumption of using getPointerSizeInBits wouldn't hold. Differential Revision: https://reviews.llvm.org/D110585
47 KiB
47 KiB