[x86] fix allowsMisalignedMemoryAccess() implementation
authorSanjay Patel <spatel@rotateright.com>
Fri, 14 Aug 2015 17:53:40 +0000 (17:53 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 14 Aug 2015 17:53:40 +0000 (17:53 +0000)
commit09ec2d3ce34ef1b1e1683b324428fd156542601d
treefa5e933ca9508e1cff70084643fd890cc506b9d2
parentfa57ebccb8ba0bbff2f708aac2c178c306a9beab
[x86] fix allowsMisalignedMemoryAccess() implementation

This patch fixes the x86 implementation of allowsMisalignedMemoryAccess() to correctly
return the 'Fast' output parameter for 32-byte accesses. To test that, an existing load
merging optimization is changed to use the TLI hook. This exposes a shortcoming in the
current logic and results in the regression test update. Changing other direct users of
the isUnalignedMem32Slow() x86 CPU attribute would be a follow-on patch.

Without the fix in allowsMisalignedMemoryAccesses(), we will infinite loop when targeting
SandyBridge because LowerINSERT_SUBVECTOR() creates 32-byte loads from two 16-byte loads
while PerformLOADCombine() splits them back into 16-byte loads.

Differential Revision: http://reviews.llvm.org/D10662

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245075 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/unaligned-32-byte-memops.ll