diff options
| author | Elena Demikhovsky <elena.demikhovsky@intel.com> | 2016-04-10 16:53:19 +0000 |
|---|---|---|
| committer | Elena Demikhovsky <elena.demikhovsky@intel.com> | 2016-04-10 16:53:19 +0000 |
| commit | 751ed0a06a9b5f667d12365c72acb2c67de16a3b (patch) | |
| tree | fba2590d305086ddf049d856bafa058836bbb5d1 /llvm/lib | |
| parent | 3255eec16c9b5def82790e0b4122554abfa9d360 (diff) | |
| download | bcm5719-llvm-751ed0a06a9b5f667d12365c72acb2c67de16a3b.tar.gz bcm5719-llvm-751ed0a06a9b5f667d12365c72acb2c67de16a3b.zip | |
Loop vectorization with uniform load
Vectorization cost of uniform load wasn't correctly calculated.
As a result, a simple loop that loads a uniform value wasn't vectorized.
Differential Revision: http://reviews.llvm.org/D18940
llvm-svn: 265901
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index d286dffdf0e..72e96cdf46d 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -5819,6 +5819,15 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I, unsigned VF, return TTI.getAddressComputationCost(VectorTy) + TTI.getMemoryOpCost(I->getOpcode(), VectorTy, Alignment, AS); + if (LI && Legal->isUniform(Ptr)) { + // Scalar load + broadcast + unsigned Cost = TTI.getAddressComputationCost(ValTy->getScalarType()); + Cost += TTI.getMemoryOpCost(I->getOpcode(), ValTy->getScalarType(), + Alignment, AS); + return Cost + TTI.getShuffleCost(TargetTransformInfo::SK_Broadcast, + ValTy); + } + // For an interleaved access, calculate the total cost of the whole // interleave group. if (Legal->isAccessInterleaved(I)) { |

