[LLVMdev] PR400 - alignment for LD/ST

Chris Lattner sabre at nondot.org
Mon Apr 2 14:12:56 PDT 2007


On Mon, 2 Apr 2007, Christopher Lamb wrote:
>>  In this model, you represent each alignment value as a pair <align,offs>,
>>  where offs is always less than align.  This allows you to say that "this
>>  load is 2 bytes away from a 16-byte aligned pointer" for example.
>
> Shouldn't it be, "this load is a multiple of 2-bytes away from a 16-byte 
> aligned pointer", isn't that more general?

It is both more general and less precise :)

> The case I'm dealing with directly pertains to indexing arrays that are 
> themselves aligned. This information allows loads/stores (say in an unrolled 
> loop) to be coalesced as they can be determined to reference to the same 
> memory.

Ok.

> This would mean that the alignment of the load itself will be align if no 
> offset is provided and min(align, offs) if an offset alignment is provided. 
> Do you think it will be difficult for the front-end to provide these two 
> alignments?

The front-end won't be able to give you information about a loop of code 
that traverses an array, but subsequent optimization/analysis passes can.

I think that either form of information would be easy to get, but I don't 
know what the tradeoffs are (loss of generality or loss of precision). 
Devang, do you have any thoughts on this or idea of how it would impact a 
vectorizor?

> Also, I've noticed that a some transformations on Loads/Stores don't preserve 
> either volatility or alignment information.

I'm not suprised about the alignment piece (it hasn't been filled in yet) 
but not preserving volatility is definitely a bug.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list