From: Chris Lattner Date: Wed, 14 May 2003 02:47:13 +0000 (+0000) Subject: Fix bug X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=e0c60038ebf0d259b28954a380adcbed9b5a39ee;p=oota-llvm.git Fix bug git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6184 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index ee5611ea7de..db8cc4487c1 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(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(CE->getOperand(0)->getType())) if (const ArrayType *SAT = dyn_cast(SPT->getElementType()))