[PATCH] Fix alignment checks in MergeConsecutiveStores.

James Y Knight jyknight at google.com
Tue Apr 7 22:17:09 PDT 2015


1) Check whether the memory alignment is sufficient for the *merged*
store or load before merging.

Not doing so can result in ridiculously poor code generation, if
merging creates a vector operation.

2) Don't check that the alignment of each load/store is equal.

If you're merging two consecutive 4-byte stores, and the first *does*
have 8-byte alignment, the second certainly won't. But that should be
acceptable to merge.

3) Don't have it implement its own idea of what unaligned is:
"(Index->getAlignment()*8 != MemVT.getSizeInBits())".  Removal of that
check allows generation of vmovups for an unaligned copy on x86 where
it wasn't before (which I think is desirable, right?)

http://reviews.llvm.org/D8891

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/PowerPC/MergeConsecutiveStores.ll
  test/CodeGen/X86/MergeConsecutiveStores.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8891.23398.patch
Type: text/x-patch
Size: 11958 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150408/ce3b16b6/attachment.bin>


More information about the llvm-commits mailing list