[LLVMdev] RFC: Indexing of structs vs arrays in getelementpointer

Hal Finkel
Fri, 23 May 2014 04:23:50 -0000

----- Original Message -----
> From: "Chandler Carruth" <chandlerc at google.com>
> To: "Hal Finkel" <hfinkel at anl.gov>
> Cc: "LLVM Developers Mailing List" <llvmdev at
cs.uiuc.edu>, "Louis Gerbarg" <lgg at apple.com>
> Sent: Thursday, May 22, 2014 10:04:27 PM
> Subject: Re: [LLVMdev] RFC: Indexing of structs vs arrays in
getelementpointer
>
>
>
>
>
> On Thu, May 22, 2014 at 8:19 PM, Hal Finkel < hfinkel at anl.gov >
> wrote:
>
>
>
>
> > While clearly we can make this transform safely for homogenous
> > structs, doing so seriously weakens the IR's guarantees. I'd
not
> > like to see us go that direction.
>
> To what guarantees are you referring?
> That we can (verifier) reject arbitrarily invalid sequences of
> indices in GEPs into structs because we know which struct we're
> GEPing into and what potential indices would be valid. This in turn
> simplifies the interfaces of code dealing with struct GEP indices.

Ah, okay. Then what do you mean by, "fold homogeneous struct type layers
into arrays."? Do you mean refactor to make them look like arrays at the
API level?

 -Hal

--
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory