[llvm-commits] [llvm] r91614 - in /llvm/trunk: include/llvm/CodeGen/ValueTypes.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Ken Dyck Ken.Dyck at onsemi.com
Fri Jan 15 07:30:45 PST 2010


On Wednesday, January 06, 2010 6:15 AM, Duncan Sands wrote:
> 
> > Introduce EVT::getHalfSizedIntegerVT() for use in 
> > ExpandUnalignedStore() in LegalizeDAG.cpp. Unlike the code it 
> > replaces, which simply decrements the simple type by one, 
> > getHalfSizedIntegerVT() searches for the smallest simple 
> integer type 
> > that is at least half the size of the type it is called on. This 
> > approach has the advantage that it will continue working if a new 
> > value type (such as
> > i24) is added to MVT.
> 
> I don't think this is correct.  Consider an unaligned store 
> of i24.  This should write 3 bytes to memory.  It looks like 
> getHalfSizedIntegerVT will return i16.
> ExpandUnalignedStore will then write an i16 followed by 
> another one, writing
> 4 bytes, which is wrong.  

I still have some more work to do before I get a general solution
working. In the meantime, the attached patch should fix the problem you
describe (albeit with potentially more unaligned stores than necessary
for non-power-of-2 types). Any objections to committing this patch as a
temporary fix?

-Ken
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LegalizeDAG.ExpandUnalignedStore-stop-gap-fix.diff
Type: application/octet-stream
Size: 1684 bytes
Desc: LegalizeDAG.ExpandUnalignedStore-stop-gap-fix.diff
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100115/3fa4a347/attachment.obj>


More information about the llvm-commits mailing list