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)
commit7a641cc94099f384ed8f918322288a7a0fbbd0ba
tree25e80afca8cc6f4abe742f705edb13c3292c4f7b
parent8ad735a538bda0ca42a18d4e6917d54e6dedb290
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243549 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetLowering.h
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/CodeGen/TargetLoweringBase.cpp