[PATCH] D10905: move DAGCombiner's allowableAlignment() helper function into the TLI

Sanjay Patel spatel at rotateright.com
Thu Jul 2 13:21:01 PDT 2015


spatel created this revision.
spatel added reviewers: jyknight, qcolombet.
spatel added a subscriber: llvm-commits-list.

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 but not checking for a 'fast' unaligned op. In this implementation, we use getPrefTypeAlignment() when determining if an access is fast, but getABITypeAlignment() when just checking if an access is allowed. 

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. So if we agree that this patch is ok, I'll get back to that patch ASAP.

http://reviews.llvm.org/D10905

Files:
  include/llvm/Target/TargetLowering.h
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
  lib/CodeGen/TargetLoweringBase.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10905.28968.patch
Type: text/x-patch
Size: 13092 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150702/f65c715a/attachment.bin>


More information about the llvm-commits mailing list