summaryrefslogtreecommitdiff
path: root/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2012-01-31 04:42:22 +0000
committerChris Lattner <sabre@nondot.org>2012-01-31 04:42:22 +0000
commit3ef9cfef13d7c7208b98b2d9995c3df6dcfe0d99 (patch)
tree871a22cfc34d8f8a494233a478d34e10f4f7293f /lib/Analysis/ConstantFolding.cpp
parent4a6facbc574c37ec81380d31d8f1372ea10ebf29 (diff)
downloadllvm-3ef9cfef13d7c7208b98b2d9995c3df6dcfe0d99.tar.gz
llvm-3ef9cfef13d7c7208b98b2d9995c3df6dcfe0d99.tar.bz2
llvm-3ef9cfef13d7c7208b98b2d9995c3df6dcfe0d99.tar.xz
Change ConstantArray::get to form a ConstantDataArray when possible,
kicking in the big win of ConstantDataArray. As part of this, change the implementation of GetConstantStringInfo in ValueTracking to work with ConstantDataArray (and not ConstantArray) making it dramatically, amazingly, more efficient in the process and renaming it to getConstantStringInfo. This keeps around a GetConstantStringInfo entrypoint that (grossly) forwards to getConstantStringInfo and constructs the std::string required, but existing clients should move over to getConstantStringInfo instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149351 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ConstantFolding.cpp')
-rw-r--r--lib/Analysis/ConstantFolding.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index 121e334c4c..48e75a1d5d 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/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