This is an archive of the discontinued LLVM Phabricator instance.

Fix alignment checks in MergeConsecutiveStores.
ClosedPublic

Authored by jyknight on Apr 7 2015, 10:16 PM.

Details

Reviewers
qcolombet
Summary
  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.

  1. 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.

  1. 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?)

Diff Detail

Event Timeline

jyknight updated this revision to Diff 23398.Apr 7 2015, 10:16 PM
jyknight retitled this revision from to Fix alignment checks in MergeConsecutiveStores..
jyknight updated this object.
jyknight edited the test plan for this revision. (Show Details)
jyknight added a subscriber: Unknown Object (MLST).
qcolombet accepted this revision.May 5 2015, 2:26 PM
qcolombet added a reviewer: qcolombet.
qcolombet added a subscriber: qcolombet.

Hi James,

LGTM.

Thanks,
-Quentin

lib/CodeGen/SelectionDAG/DAGCombiner.cpp
10161

I think the coding style says lower case for the first letter of a function name.
http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly

This revision is now accepted and ready to land.May 5 2015, 2:26 PM
jyknight closed this revision.May 8 2015, 8:22 AM

Committed in r236850 and test fixed for darwin in r236855.

lib/CodeGen/SelectionDAG/DAGCombiner.cpp
10161

It does, fixed.

(And thanks again for the review!)