[dragonegg PATCH] Use the preferred alignment when deciding whether to use an explicit alignment

Duncan Sands baldrick at free.fr
Tue Apr 16 23:40:32 PDT 2013


Hi Peter,

On 16/04/13 23:13, Peter Collingbourne wrote:
> On Tue, Apr 02, 2013 at 02:44:32PM -0700, Peter Collingbourne wrote:
>> On Tue, Apr 02, 2013 at 11:23:09PM +0200, Duncan Sands wrote:
>>> Hi Peter,
>>>
>>>> Use the preferred alignment when deciding whether to use an explicit
>>>> alignment.
>>>>
>>>> OK to commit?
>>>
>>> I don't like it.  An alignment of 0 for a global variable guarantess it gets
>>> at least the ABI alignment, but maybe no more.  The optimizers may increase it
>>> in cases where that seems safe and profitable to them, usually to the preferred
>>> alignment, but they may not always do so.  In such cases (where the global only
>>> gets the ABI alignment) your patch would decrease the alignment from what the
>>> user requested (the preferred alignment) to the ABI alignment, which would be
>>> wrong.
>>
>> That makes sense.  What about this, where we always use an explicit
>> alignment if DECL_USER_ALIGN holds?

it looks good, except that there is an instance of exactly the same logic in
Convert.cpp too, and the comment lines are too long.  I've made the same change
in Convert.cpp, wrapped the comment lines, and applied it in commit 179668.

Ciao, Duncan.



More information about the llvm-commits mailing list