summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-10-29 19:43:31 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-10-29 19:43:31 +0000
commit594ee779641786036eb0409cba30a0f100161378 (patch)
tree4fa873debcfd46b1fb5503ff2b2fbfa7c91060ac /llvm/lib/Transforms
parent9780553ef0c17574b8f6838b4a43211d72972b4f (diff)
downloadbcm5719-llvm-594ee779641786036eb0409cba30a0f100161378.tar.gz
bcm5719-llvm-594ee779641786036eb0409cba30a0f100161378.zip
SimplifyLibCalls: Use IRBuilder.CreateGlobalString when creating a string for printf->puts, which correctly sets the unnamed_addr bit on the resulting GlobalVariable.
Fixes PR11264. llvm-svn: 143289
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp
index fbb9465743c..2a00ae1093b 100644
--- a/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp
+++ b/llvm/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);
}
OpenPOWER on IntegriCloud