[llvm-dev] LLVM IR: 'class llvm::Instruction' has no member named 'getAddressSpace'
Vedant Kumar via llvm-dev
llvm-dev at lists.llvm.org
Mon Nov 28 13:46:16 PST 2016
> On Nov 28, 2016, at 1:31 PM, Gurunath Kadam via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> I have following LLVM IR instruction:
>
> %ptrA = getelementptr float, float addrspace(1)* %A, i32 %id
>
> To get the addrspace value, do I use function call getAddressSpace() or getPointerAddressSpace() ?
>
> Using getAddressSpace() results in following error:
>
> 'class llvm::Instruction' has no member named 'getAddressSpace'
>
> But I see these methods in Instruction.h implemented for getelementptr inst class.
GetElementPtrInst subclasses Instruction, so you need a cast. E.g:
if (auto *GEP = dyn_cast<llvm::GetElementPtrInst>(I))
return GEP->getAddressSpace();
> P.S.: is this the right forum to ask such questions? I see very high-level discussions going on here. If this is not the right forum then please guide me to the appropriate one. Otherwise thanks.
llvm-dev is fine.
best,
vedant
More information about the llvm-dev
mailing list