summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2012-02-05 02:29:43 +0000
committerChris Lattner <sabre@nondot.org>2012-02-05 02:29:43 +0000
commitcf9e8f6968af1e5871b535a06a6bff45de49e4bf (patch)
tree00731766834527ed56ba142710486c79d01c875e /llvm/lib/Analysis/ConstantFolding.cpp
parent2c1dd2716a07a173773ac2ba04b5f2da73a1fc6c (diff)
downloadbcm5719-llvm-cf9e8f6968af1e5871b535a06a6bff45de49e4bf.tar.gz
bcm5719-llvm-cf9e8f6968af1e5871b535a06a6bff45de49e4bf.zip
reapply the patches reverted in r149470 that reenable ConstantDataArray,
but with a critical fix to the SelectionDAG code that optimizes copies from strings into immediate stores: the previous code was stopping reading string data at the first nul. Address this by adding a new argument to llvm::getConstantStringInfo, preserving the behavior before the patch. llvm-svn: 149800
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r--llvm/lib/Analysis/ConstantFolding.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index 121e334c4cc..48e75a1d5d7 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -476,9 +476,9 @@ Constant *llvm::ConstantFoldLoadFromConstPtr(Constant *C,
// Instead of loading constant c string, use corresponding integer value
// directly if string length is small enough.
- std::string Str;
- if (TD && GetConstantStringInfo(CE, Str) && !Str.empty()) {
- unsigned StrLen = Str.length();
+ StringRef Str;
+ if (TD && getConstantStringInfo(CE, Str) && !Str.empty()) {
+ unsigned StrLen = Str.size();
Type *Ty = cast<PointerType>(CE->getType())->getElementType();
unsigned NumBits = Ty->getPrimitiveSizeInBits();
// Replace load with immediate integer if the result is an integer or fp
OpenPOWER on IntegriCloud