move DAGCombiner's allowableAlignment() helper function into the TLI
authorSanjay Patel <spatel@rotateright.com>
Wed, 29 Jul 2015 18:24:18 +0000 (18:24 +0000)
committerSanjay Patel <spatel@rotateright.com>
Wed, 29 Jul 2015 18:24:18 +0000 (18:24 +0000)
commit0f9dcf8b90aaeb0a98dd79eda43e623f4a55231a
tree602a6e24d840ec7732ba0c6090102127ec9d2a55
parent4d81f86d976466a38a3bd75365587b7c84f72d41
move DAGCombiner's allowableAlignment() helper function into the TLI

Making allowableAlignment() more accessible was suggested as a predecessor patch
for D10662, so I've pulled it into TargetLowering. This let's us remove 4 instances
of duplicate logic in LegalizeDAG.

There's a subtle functional change in the implementation: the existing
allowableAlignment() code was using getPrefTypeAlignment() when checking
alignment with the DataLayout and assumed that was fast. In this implementation,
we use getABITypeAlignment() and assume that is fast. See the TODO comment or the
discussion in the Phab review for future improvements in this implementation
(don't use the data layout at all).

There are no regression test changes from this difference, and I'm not sure how to
expose it via a test. I think we actually do want to provide the 'Fast' param when
checking this from DAGCombiner::MergeConsecutiveStores(). Ie, we shouldn't merge
stores if the new stores are not going to be fast. But that change will require
fixing allowsMisalignedMemoryAccess() overrides as noted in D10662.

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

llvm-svn: 243549
llvm/include/llvm/Target/TargetLowering.h
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/lib/CodeGen/TargetLoweringBase.cpp