llvmlite
llvmlite copied to clipboard
llvmlite opaque pointer support
The plan of record is that non-opaque pointer support remains in LLVM 16 (with decreasing test coverage) and will be removed in LLVM 17: https://reviews.llvm.org/D140487
The direct breakages I saw when opaque pointers are enabled by default are caused by llvmlite's method of getting ABI size and alignment for values, which it does by creating a module, declaring a global value of the right type, and then interrogating that.
Someone more knowledgeable than me pointed out "A GlobalValue's type is a pointer, but instead of GV->getType()->getElementType(), you can do GV->getValueType().", and implementing this succeeded in getting tests passing again.
I'll prepare a patch for review to close this bug, but I wanted to kick off a discussion here to make sure that what I'm proposing doesn't have other issues that I'm not aware of and maybe haven't been picked up by test cases.
Changes, in summary are:
ValueRefgets@property global_value_type, which returns the value type ifselfis a global value.Type._get_ll_pointer_typebecomesType._get_ll_global_value_typeand usages change like so:
- llty = self._get_ll_pointer_type(target_data, context)
- return target_data.get_pointee_abi_size(llty)
+ llty = self._get_ll_global_value_type(target_data, context)
+ return target_data.get_abi_size(llty)
- expose
LLVMABIAlignmentOfTypebinding to replaceget_pointee_abi_alignment - (with deprecation schedule) remove
LLVMPY_GetElementType,LLVMPY_ABISizeOfElementTypeandLLVMPY_ABIAlignmentOfElementTypeand associated python code.
Should this issue be closed due to https://github.com/numba/llvmlite/pull/1064 being merged? Or is it waiting to be released? (I ran into this issue when trying to use llvmlite 0.43.0 with clang-18-generated llvm IR, not realizing the version mattered)