[LLVMdev] Extending GetElementPointer, or Premature Linearization Considered Harmful
Chris Lattner
clattner at apple.com
Fri May 4 09:56:48 PDT 2012
On May 4, 2012, at 8:59 AM, Duncan Sands wrote:
>>> This is where you run into trouble, because this is an array with a variable
>>> sized element type.
>>>
>>> Currently GEP is designed so that the offset from the base pointer is an affine
>>> function *with constant multipliers*, eg: 3*x + 10*y.
>>
>> I merely argue for allowing constant-but-unknown multipliers, i.e.,
>> parameters. They're still affine for purposes of dependence analysis
>> (by things like the Delta test or Polly), but oh so much more useful.
>>
>> Multi-dimensional VLAs happen, especially in scientific code. How are
>> we going to express DGEMM (matrix multiplication)? We could do it by
>> manually linearizing all the array references, or we could do it the
>> way god intended when he standardized C90, with VLAs. I'm arguing that
>> it would be wonderful to be able to analyze such code accurately.
>
> this would be a radical change to GEP, and as such would mean a huge amount of
> work. That said, being able to describe affine functions with locally constant
> multipliers in a nice and effective way would be great. I expect that this is
> really a job for SCEV, not for GEP. Hopefully Chris will comment on this issue.
I think it's fair to say that this is an artifact of LLVM's early design being too focused on C. Generalizing GEP like this would be very reasonable and I'm supportive of that, but the devil in the details :)
-Chris
More information about the llvm-dev
mailing list