[llvm-commits] [llvm-gcc-4.2] r62076 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Evan Cheng echeng at apple.com
Wed Jan 14 11:01:03 PST 2009


On Jan 14, 2009, at 3:46 AM, Duncan Sands wrote:

> Hi Evan,
>
>> This gets translated into low level pointer arithmetics, right? Later
>> on llvm-convert casts it to i8*:
>>
>> ArrayAddr = BitCastToType(ArrayAddr,
>> PointerType::getUnqual(Type::Int8Ty));
>>
>> Is there a reason why we can't just give it the alignment of i8?
>
> I just had some coffee and woke up.  It is of course always safe to
> give an alignment of 1.

Right. I am saying for array_ref that is turned into pointer  
arithmetics + load / store i8, just return lvalue with alignment 1. It  
is always correct. The down size I see if theoretically this could  
prevent some optimization that combine multiple loads / stores into a  
larger one. I think we can eliminate most of these potential cases by  
calling getPointerAlignment() when the type is POINTER_TYPE.

The main issue is I'd like to fix the bug where we emit memory  
instructions with artificially high alignment. But I am willing to  
invest a significant effort to change Emit. I'll cook up with another  
patch with those x86-64 linux (which obviously hates me) failures fixed.

Evan

>
>
> Ciao,
>
> Duncan.




More information about the llvm-commits mailing list