summaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-05-14 02:47:13 +0000
committerChris Lattner <sabre@nondot.org>2003-05-14 02:47:13 +0000
commite0c60038ebf0d259b28954a380adcbed9b5a39ee (patch)
treecec3166afd4ea790999361a306ebd734666f7861 /lib/VMCore
parent7cb77e188f52b61f3a71ca361704d88e6d146d03 (diff)
downloadllvm-e0c60038ebf0d259b28954a380adcbed9b5a39ee.tar.gz
llvm-e0c60038ebf0d259b28954a380adcbed9b5a39ee.tar.bz2
llvm-e0c60038ebf0d259b28954a380adcbed9b5a39ee.tar.xz
Fix bug
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6184 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/ConstantFold.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp
index ee5611ea7d..db8cc4487c 100644
--- a/lib/VMCore/ConstantFold.cpp
+++ b/lib/VMCore/ConstantFold.cpp
@@ -157,7 +157,8 @@ Constant *ConstantFoldGetElementPtr(const Constant *C,
// To: int* getelementptr ([3 x int]* %X, long 0, long 0)
//
if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
- if (CE->getOpcode() == Instruction::Cast && IdxList.size() > 1)
+ if (CE->getOpcode() == Instruction::Cast && IdxList.size() > 1 &&
+ IdxList[0]->isNullValue())
if (const PointerType *SPT =
dyn_cast<PointerType>(CE->getOperand(0)->getType()))
if (const ArrayType *SAT = dyn_cast<ArrayType>(SPT->getElementType()))