aboutsummaryrefslogtreecommitdiff
path: root/llvm/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
commit1ddfd9f96cae0aabb20f025bc6993ede3976caa5 (patch)
tree47640ef8799fa54c9b8da1d11475867fb4c096fa /llvm/lib/Analysis/ConstantFolding.cpp
parent5c9e7b16a5ae83fda7aa3f9dd0736ec7b0b9edf2 (diff)
downloadllvm-1ddfd9f96cae0aabb20f025bc6993ede3976caa5.zip
llvm-1ddfd9f96cae0aabb20f025bc6993ede3976caa5.tar.gz
llvm-1ddfd9f96cae0aabb20f025bc6993ede3976caa5.tar.bz2
Fix PR5551 by not ignoring the top level constantexpr when
folding a load from constant. llvm-svn: 90545
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r--llvm/lib/Analysis/ConstantFolding.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index 4b0b9a5..eaf90d0 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/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();