summaryrefslogtreecommitdiff
path: root/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-04 06:29:29 +0000
committerChris Lattner <sabre@nondot.org>2009-12-04 06:29:29 +0000
commit44a7a380aa9fbb303f57f4f8269062b7b56be980 (patch)
tree844e2b9e276bd18c2aa3d7ea9c99dfd4ab20a45d /lib/Analysis/ConstantFolding.cpp
parentbbf9a5845acf35167211128b1b4b1b81d38ccb31 (diff)
downloadllvm-44a7a380aa9fbb303f57f4f8269062b7b56be980.tar.gz
llvm-44a7a380aa9fbb303f57f4f8269062b7b56be980.tar.bz2
llvm-44a7a380aa9fbb303f57f4f8269062b7b56be980.tar.xz
Fix PR5551 by not ignoring the top level constantexpr when
folding a load from constant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90545 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ConstantFolding.cpp')
-rw-r--r--lib/Analysis/ConstantFolding.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index 4b0b9a54c7..eaf90d014f 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/lib/Analysis/ConstantFolding.cpp
@@ -432,7 +432,7 @@ 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->getOperand(0), Str) && !Str.empty()) {
+ if (TD && GetConstantStringInfo(CE, Str) && !Str.empty()) {
unsigned StrLen = Str.length();
const Type *Ty = cast<PointerType>(CE->getType())->getElementType();
unsigned NumBits = Ty->getPrimitiveSizeInBits();