diff options
author | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2021-09-27 13:54:32 +0200 |
---|---|---|
committer | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2021-09-28 15:29:37 +0200 |
commit | 1f5ea14bca71aecad1f5a6017ff20fe50c9da752 (patch) | |
tree | 3957430add2bae0cd9daf99c24c68e82fc98fbbf /llvm/lib/Analysis/TargetLibraryInfo.cpp | |
parent | 86bf234d0b7038479292a0d771dc05966140b908 (diff) | |
download | llvm-1f5ea14bca71aecad1f5a6017ff20fe50c9da752.zip llvm-1f5ea14bca71aecad1f5a6017ff20fe50c9da752.tar.gz llvm-1f5ea14bca71aecad1f5a6017ff20fe50c9da752.tar.bz2 |
[Analysis] Add FIXME:s related to size_t type checks
Differential Revision: https://reviews.llvm.org/D110583
Diffstat (limited to 'llvm/lib/Analysis/TargetLibraryInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/TargetLibraryInfo.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp index 570d960..bc9aab3 100644 --- a/llvm/lib/Analysis/TargetLibraryInfo.cpp +++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp @@ -727,9 +727,19 @@ bool TargetLibraryInfoImpl::isValidProtoForLibFunc(const FunctionType &FTy, LibFunc F, const DataLayout *DL) const { LLVMContext &Ctx = FTy.getContext(); + // 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 + // SizeTTy based on DataLayout and getIntPtrType isn't always valid. Type *SizeTTy = DL ? DL->getIntPtrType(Ctx, /*AddressSpace=*/0) : nullptr; auto IsSizeTTy = [SizeTTy](Type *Ty) { - return SizeTTy ? Ty == SizeTTy : Ty->isIntegerTy(); + // FIXME: For uknown historical reasons(?) we use a relaxed condition saying + // that any integer type may size_t, for example if we got no + // DataLayout. This seems like a potentially error prone relaxation (or why + // should we only be more strict and checking the exact type when we have a + // DataLayout?). + if (!SizeTTy) + return Ty->isIntegerTy(); + return Ty == SizeTTy; }; unsigned NumParams = FTy.getNumParams(); |