[llvm-commits] [llvm] r145273 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/ARM/2011-11-28-DAGCombineBug.ll test/CodeGen/X86/widen_load-1.ll

Evan Cheng evan.cheng at apple.com
Mon Nov 28 13:57:20 PST 2011


On Nov 28, 2011, at 1:47 PM, Chris Lattner wrote:

> 
> On Nov 28, 2011, at 12:54 PM, Duncan Sands wrote:
> 
>> Hi Evan,
>> 
>>> DAG combine should not increase alignment of loads / stores with alignment less
>>> than ABI alignment. These are loads / stores from / to "packed" data structures.
>>> Their alignments are intentionally under-specified.
>> 
>> this doesn't make any sense to me.  Load/store alignment should only be
>> increased, say from 2 to 4, if it can be proved that the memory being
>> pointed to is 4 byte aligned.  If InferPtrAlignment is working correctly,
>> it should only be returning 4 if the memory really is 4 byte aligned.
>> If you have to sometimes ignore what InferPtrAlignment returns because
>> (presumably) the memory isn't actually 4 byte aligned, doesn't that just
>> mean that InferPtrAlignment is buggy and should be fixed?
> 
> I agree, this doesn't make any sense to me either.  Underaligned loads are exactly the kind that we want to infer improved alignments for!

The problem is alignment information is only attached to load / store instructions, not on types. If the global variable is not given an alignment, InferPtrAlignment is inferring alignment from the type. After r140902, it's using ABI alignment for GV's which are not specified alignments. Should it return zero instead?

Evan

> 
> -Chris




More information about the llvm-commits mailing list