[llvm] [llvm-c] Provide LLVMGetGEPResultElementType (PR #95693)

Vaivaswatha N via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 08:42:44 PDT 2024


vaivaswatha wrote:

> > > The result element type is redundant information implied by the source element type and the GEP arguments
> > 
> > 
> > True, but then shouldn't `getIndexedType` be available for use in the C-API?. Without it, someone using the C-API would need to reimplement it to compute the result element type (as far as I can tell, please correct me if there's some way to compute it already).
> 
> My primary point is that you shouldn't need any of these at all. Can you please explain in more detail how you are going to use this API?

To begin with, I'm just trying to read the IR and kind of type-check it all myself. So I need to know the type that the GEP's result pointer is pointing to.

Is there a design philosophy that the C-API needs to be minimal / restricted and not be as general as the C++ API? If `getIndexedType` is part of the C++ public API, I fail to understand why it can't be part of the C-API.

https://github.com/llvm/llvm-project/pull/95693


More information about the llvm-commits mailing list