BBVectorize: Use TTI->getAddressComputationCost
authorHal Finkel <hfinkel@anl.gov>
Fri, 8 Feb 2013 21:13:39 +0000 (21:13 +0000)
committerHal Finkel <hfinkel@anl.gov>
Fri, 8 Feb 2013 21:13:39 +0000 (21:13 +0000)
This is a follow-up to the cost-model change in r174713 which splits
the cost of a memory operation between the address computation and the
actual memory access. In r174713, this cost is always added to the
memory operation cost, and so BBVectorize will do the same.

Currently, this new cost function is used only by ARM, and I don't
have any ARM test cases for BBVectorize. Assistance in generating some
good ARM test cases for BBVectorize would be greatly appreciated!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174743 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Vectorize/BBVectorize.cpp

index 9bf09ff122e52a6e7861c6311fe8e4ccbad9bcef..ec10b4207b526dcca4c61187821b5673f7bc989c 100644 (file)
@@ -972,6 +972,11 @@ namespace {
           unsigned VCost = TTI->getMemoryOpCost(I->getOpcode(), VType,
                                                 BottomAlignment,
                                                 IAddressSpace);
+
+          ICost += TTI->getAddressComputationCost(aTypeI);
+          JCost += TTI->getAddressComputationCost(aTypeJ);
+          VCost += TTI->getAddressComputationCost(VType);
+
           if (VCost > ICost + JCost)
             return false;