diff --git a/lib/IR/ConstantFold.cpp b/lib/IR/ConstantFold.cpp index ce3fe03e2df..35855860129 100644 --- a/lib/IR/ConstantFold.cpp +++ b/lib/IR/ConstantFold.cpp @@ -2040,11 +2040,11 @@ static Constant *ConstantFoldGetElementPtrImpl(Type *PointeeTy, Constant *C, return C; if (isa(C)) { - PointerType *Ptr = cast(C->getType()); + PointerType *PtrTy = cast(C->getType()); Type *Ty = GetElementPtrInst::getIndexedType( - cast(Ptr->getScalarType())->getElementType(), Idxs); + cast(PtrTy->getScalarType())->getElementType(), Idxs); assert(Ty && "Invalid indices for GEP!"); - return UndefValue::get(PointerType::get(Ty, Ptr->getAddressSpace())); + return UndefValue::get(PointerType::get(Ty, PtrTy->getAddressSpace())); } if (C->isNullValue()) { @@ -2055,12 +2055,12 @@ static Constant *ConstantFoldGetElementPtrImpl(Type *PointeeTy, Constant *C, break; } if (isNull) { - PointerType *Ptr = cast(C->getType()); + PointerType *PtrTy = cast(C->getType()); Type *Ty = GetElementPtrInst::getIndexedType( - cast(Ptr->getScalarType())->getElementType(), Idxs); + cast(PtrTy->getScalarType())->getElementType(), Idxs); assert(Ty && "Invalid indices for GEP!"); return ConstantPointerNull::get(PointerType::get(Ty, - Ptr->getAddressSpace())); + PtrTy->getAddressSpace())); } }