mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-15 07:39:31 +00:00
[LSV] Use a set rather than an ArraySlice at the end of getVectorizablePrefix. NFC
Summary: This avoids a small O(n^2) loop. Reviewers: asbirlea Subscribers: mzolotukhin, llvm-commits, arsenm Differential Revision: https://reviews.llvm.org/D23473 llvm-svn: 278581
This commit is contained in:
parent
ead5074d8e
commit
5948b35436
@ -516,12 +516,11 @@ Vectorizer::getVectorizablePrefix(ArrayRef<Instruction *> Chain) {
|
||||
// ChainInstrs[0, ChainInstrIdx). This is the largest vectorizable prefix of
|
||||
// Chain. (Recall that Chain is in address order, but ChainInstrs is in BB
|
||||
// order.)
|
||||
auto VectorizableChainInstrs =
|
||||
makeArrayRef(ChainInstrs.data(), ChainInstrIdx);
|
||||
unsigned ChainIdx, ChainLen;
|
||||
for (ChainIdx = 0, ChainLen = Chain.size(); ChainIdx < ChainLen; ++ChainIdx) {
|
||||
Instruction *I = Chain[ChainIdx];
|
||||
if (!is_contained(VectorizableChainInstrs, I))
|
||||
SmallPtrSet<Instruction *, 8> VectorizableChainInstrs(
|
||||
ChainInstrs.begin(), ChainInstrs.begin() + ChainInstrIdx);
|
||||
unsigned ChainIdx = 0;
|
||||
for (unsigned ChainLen = Chain.size(); ChainIdx < ChainLen; ++ChainIdx) {
|
||||
if (!VectorizableChainInstrs.count(Chain[ChainIdx]))
|
||||
break;
|
||||
}
|
||||
return Chain.slice(0, ChainIdx);
|
||||
|
Loading…
Reference in New Issue
Block a user