diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-10-29 19:43:31 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-10-29 19:43:31 +0000 |
commit | 59e43bde289750a4683879727a9e0e41ab7000a6 (patch) | |
tree | eb55041fdc5971d35d56fadbe473b63f92931499 /lib/Transforms/Scalar/SimplifyLibCalls.cpp | |
parent | 987d976efc2176e68059387fb1ab793042874327 (diff) | |
download | llvm-59e43bde289750a4683879727a9e0e41ab7000a6.tar.gz llvm-59e43bde289750a4683879727a9e0e41ab7000a6.tar.bz2 llvm-59e43bde289750a4683879727a9e0e41ab7000a6.tar.xz |
SimplifyLibCalls: Use IRBuilder.CreateGlobalString when creating a string for printf->puts, which correctly sets the unnamed_addr bit on the resulting GlobalVariable.
Fixes PR11264.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143289 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/SimplifyLibCalls.cpp')
-rw-r--r-- | lib/Transforms/Scalar/SimplifyLibCalls.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/lib/Transforms/Scalar/SimplifyLibCalls.cpp index fbb9465743..2a00ae1093 100644 --- a/lib/Transforms/Scalar/SimplifyLibCalls.cpp +++ b/lib/Transforms/Scalar/SimplifyLibCalls.cpp @@ -1123,10 +1123,8 @@ struct PrintFOpt : public LibCallOptimization { // Create a string literal with no \n on it. We expect the constant merge // pass to be run after this pass, to merge duplicate strings. FormatStr.erase(FormatStr.end()-1); - Constant *C = ConstantArray::get(*Context, FormatStr, true); - C = new GlobalVariable(*Callee->getParent(), C->getType(), true, - GlobalVariable::InternalLinkage, C, "str"); - EmitPutS(C, B, TD); + Value *GV = B.CreateGlobalString(FormatStr, "str"); + EmitPutS(GV, B, TD); return CI->use_empty() ? (Value*)CI : ConstantInt::get(CI->getType(), FormatStr.size()+1); } |