diff options
| author | Sergei Barannikov <barannikov88@gmail.com> | 2024-08-28 16:09:44 +0300 |
|---|---|---|
| committer | Sergei Barannikov <barannikov88@gmail.com> | 2025-11-08 12:10:23 +0300 |
| commit | 73b19130005768e6af7ce6a50780a65feb031e7e (patch) | |
| tree | 54dff78c0cd47af66e5a7eaf7369072a60996076 /llvm/lib/Analysis/MemoryBuiltins.cpp | |
| parent | 0d66f010d7d2f1a91a41a1db311480efde023dc3 (diff) | |
[SimplifyLibCalls] Add initial support for non-8-bit bytesusers/s-barannikov/byte/7-simplify-lib-calls
The patch makes CharWidth argument of `getStringLength` mandatory
and ensures the correct values are passed in most cases.
This is *not* a complete support for unusual byte widths in
SimplifyLibCalls since `getConstantStringInfo` returns false for those.
The code guarded by `getConstantStringInfo` returning true is unchanged
because the changes are currently not testable.
Diffstat (limited to 'llvm/lib/Analysis/MemoryBuiltins.cpp')
| -rw-r--r-- | llvm/lib/Analysis/MemoryBuiltins.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp index 1df4eda2580d..c258e347ce81 100644 --- a/llvm/lib/Analysis/MemoryBuiltins.cpp +++ b/llvm/lib/Analysis/MemoryBuiltins.cpp @@ -379,7 +379,8 @@ llvm::getAllocSize(const CallBase *CB, const TargetLibraryInfo *TLI, // Handle strdup-like functions separately. if (FnData->AllocTy == StrDupLike) { - APInt Size(IntTyBits, GetStringLength(Mapper(CB->getArgOperand(0)))); + APInt Size(IntTyBits, getStringLength(Mapper(CB->getArgOperand(0)), + DL.getByteWidth())); if (!Size) return std::nullopt; |
