diff options
author | Sanjay Patel <spatel@rotateright.com> | 2021-09-22 13:24:51 -0400 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2021-09-22 13:50:12 -0400 |
commit | c240169ff2e416f2652a5d3a80a83ef68ab7fa23 (patch) | |
tree | b17b0cc9366bc2fc68085f78dfe6523151b3d2a4 /llvm/lib/Analysis/TargetLibraryInfo.cpp | |
parent | af99236747872af7e77092cbf6ddd18fa8623a2f (diff) | |
download | llvm-c240169ff2e416f2652a5d3a80a83ef68ab7fa23.zip llvm-c240169ff2e416f2652a5d3a80a83ef68ab7fa23.tar.gz llvm-c240169ff2e416f2652a5d3a80a83ef68ab7fa23.tar.bz2 |
[Analysis] improve function matching for strlen libcall
The return type of strlen is size_t, not just any integer.
This is a partial fix for an example based on:
https://llvm.org/PR50836
There's another bug here because we can still crash
processing a real strlen or something that looks like it.
Diffstat (limited to 'llvm/lib/Analysis/TargetLibraryInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/TargetLibraryInfo.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp index 0a2031d..a7027bc 100644 --- a/llvm/lib/Analysis/TargetLibraryInfo.cpp +++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp @@ -760,8 +760,8 @@ bool TargetLibraryInfoImpl::isValidProtoForLibFunc(const FunctionType &FTy, return false; LLVM_FALLTHROUGH; case LibFunc_strlen: - return (NumParams == 1 && FTy.getParamType(0)->isPointerTy() && - FTy.getReturnType()->isIntegerTy()); + return NumParams == 1 && FTy.getParamType(0)->isPointerTy() && + IsSizeTTy(FTy.getReturnType()); case LibFunc_strchr: case LibFunc_strrchr: |