diff options
Diffstat (limited to 'include/llvm/Instructions.h')
-rw-r--r-- | include/llvm/Instructions.h | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 9c526bd97b..6837608b2c 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -350,16 +350,7 @@ public: static unsigned getPointerOperandIndex() { return 1U; } unsigned getPointerAddressSpace() const { - if (getPointerOperand()->getType()->isPointerTy()) - return cast<PointerType>(getPointerOperand()->getType()) - ->getAddressSpace(); - if (getPointerOperand()->getType()->isVectorTy() - && cast<VectorType>(getPointerOperand()->getType())->isPointerTy()) - return cast<PointerType>(cast<VectorType>( - getPointerOperand()->getType())->getElementType()) - ->getAddressSpace(); - llvm_unreachable("Only a vector of pointers or pointers can be used!"); - return 0; + return cast<PointerType>(getPointerOperand()->getType())->getAddressSpace(); } // Methods for support type inquiry through isa, cast, and dyn_cast: @@ -3662,15 +3653,7 @@ public: /// @brief return the address space of the pointer. unsigned getAddressSpace() const { - if (getType()->isPointerTy()) - return cast<PointerType>(getType())->getAddressSpace(); - if (getType()->isVectorTy() && - cast<VectorType>(getType())->getElementType()->isPointerTy()) - return cast<PointerType>( - cast<VectorType>(getType())->getElementType()) - ->getAddressSpace(); - llvm_unreachable("Must be a pointer or a vector of pointers."); - return 0; + return cast<PointerType>(getType())->getAddressSpace(); } // Methods for support type inquiry through isa, cast, and dyn_cast: @@ -3712,16 +3695,7 @@ public: /// @brief return the address space of the pointer. unsigned getPointerAddressSpace() const { - Type *Ty = getOperand(0)->getType(); - if (Ty->isPointerTy()) - return cast<PointerType>(Ty)->getAddressSpace(); - if (Ty->isVectorTy() - && cast<VectorType>(Ty)->getElementType()->isPointerTy()) - return cast<PointerType>( - cast<VectorType>(Ty)->getElementType()) - ->getAddressSpace(); - llvm_unreachable("Must be a pointer or a vector of pointers."); - return 0; + return cast<PointerType>(getOperand(0)->getType())->getAddressSpace(); } // Methods for support type inquiry through isa, cast, and dyn_cast: |