gallivm: LLVM opaque pointers fixes
LLVM-15 enables opaque pointers while still supporting legacy typed pointers; but we need to migrate our code to opaque pointers before LLVM-16 arrives.
The changes are mainly along these lines:
- use LLVMBuildGEP2 and LLVMBuildLoad2 instead of the deprecated LLVMBuildGEP, LLVMBuildLoad. For this we need to know the deref-type of the pointer.
- don't query the "element type" of a pointer type.
The methods supporting opaque pointers (LLVMBuildGEP2, LLVMBuildLoad2, etc) were introduced in LLVM-8, so this is the minimal LLVM version required by this change.
This MR has been reviewed here: !18226 (closed)