I am trying to call this with a pointer to an i64 element.
This element is within an array that has below type:
ArrayType *ArrTy = ArrayType::get(Type::getInt64Ty(Mod->getContext()), size);
MyArr = new GlobalVariable(*Mod, ArrTy, …);
I am getting an assert like this:
Expression: (i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && “Calling a function with a bad signature!”
I think I am getting the pointer to a particular i64 element from the CreateInBoundsGEP().
What am I doing wrong?
You never needed to use TypeBuilder, it was just an alternative interface that was barely used and got removed. So no, you can switch away from TypeBuilder, and you’ll likely confuse fewer people by not using interfaces that were deleted a bit over 3 years ago.
I don’t think that’s a good idea. The global being in addrspace(1) might make the compiler put it somewhere strange, if not now then in the future some time.
I think the real issue is that in your new GlobalVariable(...) call you’re passing true somewhere, thinking it’s setting one option but LLVM is interpreting it as the address space. Or it could be some other enum parameter. Either way, you probably want to fix that because you’re probably not getting what you intended in other ways too.