diff options
author | Christopher Lamb <christopher.lamb@gmail.com> | 2007-12-17 01:12:55 +0000 |
---|---|---|
committer | Christopher Lamb <christopher.lamb@gmail.com> | 2007-12-17 01:12:55 +0000 |
commit | 43ad6b3e0d6ada51e9b23aab3e061187f1f5710c (patch) | |
tree | accb30ee96c29fc9e1021feaa850a435b60f81fc /lib/VMCore/ConstantFold.cpp | |
parent | 303dae993aba2474a23753ed66737b8c38cc97a0 (diff) | |
download | external_llvm-43ad6b3e0d6ada51e9b23aab3e061187f1f5710c.zip external_llvm-43ad6b3e0d6ada51e9b23aab3e061187f1f5710c.tar.gz external_llvm-43ad6b3e0d6ada51e9b23aab3e061187f1f5710c.tar.bz2 |
Change the PointerType api for creating pointer types. The old functionality of PointerType::get() has become PointerType::getUnqual(), which returns a pointer in the generic address space. The new prototype of PointerType::get() requires both a type and an address space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45082 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r-- | lib/VMCore/ConstantFold.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index a99ae9d..20e04ca 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -1383,12 +1383,13 @@ Constant *llvm::ConstantFoldGetElementPtr(const Constant *C, return const_cast<Constant*>(C); if (isa<UndefValue>(C)) { - const Type *Ty = GetElementPtrInst::getIndexedType(C->getType(), + const PointerType *Ptr = cast<PointerType>(C->getType()); + const Type *Ty = GetElementPtrInst::getIndexedType(Ptr, (Value **)Idxs, (Value **)Idxs+NumIdx, true); assert(Ty != 0 && "Invalid indices for GEP!"); - return UndefValue::get(PointerType::get(Ty)); + return UndefValue::get(PointerType::get(Ty, Ptr->getAddressSpace())); } Constant *Idx0 = Idxs[0]; @@ -1400,12 +1401,14 @@ Constant *llvm::ConstantFoldGetElementPtr(const Constant *C, break; } if (isNull) { - const Type *Ty = GetElementPtrInst::getIndexedType(C->getType(), + const PointerType *Ptr = cast<PointerType>(C->getType()); + const Type *Ty = GetElementPtrInst::getIndexedType(Ptr, (Value**)Idxs, (Value**)Idxs+NumIdx, true); assert(Ty != 0 && "Invalid indices for GEP!"); - return ConstantPointerNull::get(PointerType::get(Ty)); + return + ConstantPointerNull::get(PointerType::get(Ty,Ptr->getAddressSpace())); } } |