[llvm-commits] [llvm] r74624 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/CellSPU/ lib/Target/IA64/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/

Chris Lattner clattner at apple.com
Wed Jul 15 23:37:40 PDT 2009


On Jul 12, 2009, at 5:28 PM, Daniel Dunbar wrote:

>>
>> I vote for keeping it in log2 and standardizing on log2 form.  The
>> reason is that it takes less space to represent, it is impossible to
>> store something that is not a pow2, and it is cheaper to convert from
>> log2 -> bytes than from bytes->log2.
>
> I disagree. We can't unequivocally standardize on log2, because some
> APIs allow non-power-of-2 alignments.

What APIs are those?  What does a non-power-of-2 alignment even mean??

> Personally, I also find it more
> natural that a function named getAlignment would give me the alignment
> in bytes; your request that Bill comment on this in the method
> indicates you may even subconsciously agree with me! :)

I requested that because the APIs are inconsistent.

> I also think there are currently more places in LLVM that represent
> alignment as bytes instead of log2, and APIs which truly require a
> power-of-2 alignment can easily assert this.

Sure, but making past mistakes doesn't mean we should propagate them  
into the future :).

> And lastly, I don't think
> the performance of this operation is at all relevant.

I agree that the performance of it is not important, but the memory  
density of the storage often is.

-Chris



More information about the llvm-commits mailing list