summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/ConstantHandling.cpp
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
commit69f6af16044af34a55235dd5e8c06ba57c282c77 (patch)
treebadc0a50f4e0b7b014e52ef320d95f9424e316f7 /llvm/lib/VMCore/ConstantHandling.cpp
parenta2d3504c2432245d14837d454c4577da0dd4feb7 (diff)
downloadbcm5719-llvm-69f6af16044af34a55235dd5e8c06ba57c282c77.tar.gz
bcm5719-llvm-69f6af16044af34a55235dd5e8c06ba57c282c77.zip
Fix bug
llvm-svn: 6184
Diffstat (limited to 'llvm/lib/VMCore/ConstantHandling.cpp')
-rw-r--r--llvm/lib/VMCore/ConstantHandling.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/ConstantHandling.cpp b/llvm/lib/VMCore/ConstantHandling.cpp
index ee5611ea7de..db8cc4487c1 100644
--- a/llvm/lib/VMCore/ConstantHandling.cpp
+++ b/llvm/lib/VMCore/ConstantHandling.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()))
OpenPOWER on IntegriCloud