aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
diff options
context:
space:
mode:
authorSergei Barannikov <barannikov88@gmail.com>2024-08-04 16:12:14 +0300
committerGitHub <noreply@github.com>2024-08-04 16:12:14 +0300
commit5c48f6fa543e7d081354d3f6c1c2524eb8075223 (patch)
tree89f3bbf3a8b12ade239b1d05573d82615544ba0a /llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
parent0dba5381d8c8e4cadc32a067bf2fe5e3486ae53d (diff)
downloadllvm-5c48f6fa543e7d081354d3f6c1c2524eb8075223.zip
llvm-5c48f6fa543e7d081354d3f6c1c2524eb8075223.tar.gz
llvm-5c48f6fa543e7d081354d3f6c1c2524eb8075223.tar.bz2
[InstCombine] Don't add extra 0 to string in str[np]cpy optimization (#101884)
It is unused by subsequent memcpy.
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index ded9209..673cc1a 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -910,7 +910,8 @@ Value *LibCallSimplifier::optimizeStringNCpy(CallInst *CI, bool RetEnd,
// Create a bigger, nul-padded array with the same length, SrcLen,
// as the original string.
SrcStr.resize(N, '\0');
- Src = B.CreateGlobalString(SrcStr, "str");
+ Src = B.CreateGlobalString(SrcStr, "str", /*AddressSpace=*/0,
+ /*M=*/nullptr, /*AddNull=*/false);
}
Type *PT = Callee->getFunctionType()->getParamType(0);