diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-11-12 14:25:23 +0000 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-11-12 14:25:23 +0000 |
| commit | 631f2bf51e5a7c78a5aecb52efc06787a1499c9f (patch) | |
| tree | 42da35c6d07b0d92cdd5332d79e952cdaf13f97c /llvm/lib | |
| parent | 9c03e4cacdaa75d30b8868f3a94d997ee79bed96 (diff) | |
| download | bcm5719-llvm-631f2bf51e5a7c78a5aecb52efc06787a1499c9f.tar.gz bcm5719-llvm-631f2bf51e5a7c78a5aecb52efc06787a1499c9f.zip | |
[CostModel] Add more realistic SK_ExtractSubvector generic costs.
Instead of defaulting to a cost = 1, expand to element extract/insert like we do for other shuffles.
This exposes an issue in LoopVectorize which could call SK_ExtractSubvector with a scalar subvector type.
llvm-svn: 346656
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index c9c70b5c536..17191a19a3f 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -5826,9 +5826,10 @@ unsigned LoopVectorizationCostModel::getInstructionCost(Instruction *I, auto *Phi = cast<PHINode>(I); // First-order recurrences are replaced by vector shuffles inside the loop. + // NOTE: Don't use ToVectorTy as SK_ExtractSubvector expects a vector type. if (VF > 1 && Legal->isFirstOrderRecurrence(Phi)) return TTI.getShuffleCost(TargetTransformInfo::SK_ExtractSubvector, - VectorTy, VF - 1, ToVectorTy(RetTy, 1)); + VectorTy, VF - 1, VectorType::get(RetTy, 1)); // Phi nodes in non-header blocks (not inductions, reductions, etc.) are // converted into select instructions. We require N - 1 selects per phi |

