Update GEP constructors to use an iterator interface to fix
[oota-llvm.git] / lib / VMCore / ConstantFold.cpp
index c950e8d07ffd81da749e602e9e1f47cc2cacf26c..fb2e65f6ba605be7911364cc0329cf4f9c86d5be 100644 (file)
@@ -1350,7 +1350,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
 }
 
 Constant *llvm::ConstantFoldGetElementPtr(const Constant *C,
-                                          Constant* const *Idxs, 
+                                          Constant* const *Idxs,
                                           unsigned NumIdx) {
   if (NumIdx == 0 ||
       (NumIdx == 1 && Idxs[0]->isNullValue()))
@@ -1358,7 +1358,8 @@ Constant *llvm::ConstantFoldGetElementPtr(const Constant *C,
 
   if (isa<UndefValue>(C)) {
     const Type *Ty = GetElementPtrInst::getIndexedType(C->getType(),
-                                                       (Value**)Idxs, NumIdx,
+                                                       (Value **)Idxs,
+                                                       (Value **)Idxs+NumIdx,
                                                        true);
     assert(Ty != 0 && "Invalid indices for GEP!");
     return UndefValue::get(PointerType::get(Ty));
@@ -1374,7 +1375,8 @@ Constant *llvm::ConstantFoldGetElementPtr(const Constant *C,
       }
     if (isNull) {
       const Type *Ty = GetElementPtrInst::getIndexedType(C->getType(),
-                                                         (Value**)Idxs, NumIdx,
+                                                         (Value**)Idxs,
+                                                         (Value**)Idxs+NumIdx,
                                                          true);
       assert(Ty != 0 && "Invalid indices for GEP!");
       return ConstantPointerNull::get(PointerType::get(Ty));