[llvm-commits] [llvm] r61934 - in /llvm/trunk: lib/Analysis/ValueTracking.cpp test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll

Dan Gohman gohman at apple.com
Thu Jan 8 17:53:54 PST 2009


On Jan 8, 2009, at 4:22 PM, Chris Lattner wrote:

> On Jan 8, 2009, at 4:14 PM, Dan Gohman wrote:
>>> No, this is just something that Evan noticed.  I don't know that it
>>> actually manifested as a bug.
>>
>>
>> This is actually a pretty significant language change.  With this
>> commit, if front-ends want loads and stores from allocas to be done
>> with preferred alignment, they have to add all the alignment
>> directives manually. Previously, this just happened automatically.
>>
>> I think the previous behavior is more useful. It doesn't make a
>> lot of sense to pretend that the allocas might not be allocated
>> according to preferred alignment when they always are.
>
> I don't agree. I would call this a deficiency in
> EnforceKnownAlignment.  EnforceKnownAlignment is the routine
> responsible for saying "hey I could speed stuff up by making this
> global be 16-byte aligned" etc.  Why not do it for allocas also?


EnforceKnownAlignment already does work on allocas.  But it only
works when there's a direct load or store to an alloca in the same
function or to a GlobalVariable defined (not just declared) in the
same module.  As such, it doesn't apply in all cases.

I suppose we could do something like the attached patch, which
makes all alloca alignments explicit.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: alloca-align.patch
Type: application/octet-stream
Size: 1361 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090108/b908a1ee/attachment.obj>
-------------- next part --------------



This patch doesn't cover GlobalVariables, but they could be handled
similarly somewhere.

Dan



More information about the llvm-commits mailing list