Skip to content

Commit 4c6fbe9

Browse files
committed
[NFC][ARM][ParallelDSP] Remove ValueList
We only care about the first element in the list. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367660 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 9fcaf1b commit 4c6fbe9

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lib/Target/ARM/ARMParallelDSP.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ namespace {
4949

5050
using MulCandList = SmallVector<std::unique_ptr<MulCandidate>, 8>;
5151
using ReductionList = SmallVector<Reduction, 8>;
52-
using ValueList = SmallVector<Value*, 8>;
5352
using MemInstList = SmallVector<LoadInst*, 8>;
5453
using PMACPair = std::pair<MulCandidate*,MulCandidate*>;
5554
using PMACPairList = SmallVector<PMACPair, 8>;
@@ -64,8 +63,8 @@ namespace {
6463
bool Exchange = false;
6564
bool ReadOnly = true;
6665

67-
MulCandidate(Instruction *I, ValueList &lhs, ValueList &rhs) :
68-
Root(I), LHS(lhs.front()), RHS(rhs.front()) { }
66+
MulCandidate(Instruction *I, Value *lhs, Value *rhs) :
67+
Root(I), LHS(lhs), RHS(rhs) { }
6968

7069
bool HasTwoLoadInputs() const {
7170
return isa<LoadInst>(LHS) && isa<LoadInst>(RHS);
@@ -95,7 +94,7 @@ namespace {
9594

9695
/// Record a MulCandidate, rooted at a Mul instruction, that is a part of
9796
/// this reduction.
98-
void InsertMul(Instruction *I, ValueList &LHS, ValueList &RHS) {
97+
void InsertMul(Instruction *I, Value *LHS, Value *RHS) {
9998
Muls.push_back(make_unique<MulCandidate>(I, LHS, RHS));
10099
}
101100

@@ -171,7 +170,7 @@ namespace {
171170
std::map<LoadInst*, std::unique_ptr<WidenedLoad>> WideLoads;
172171

173172
template<unsigned>
174-
bool IsNarrowSequence(Value *V, ValueList &VL);
173+
bool IsNarrowSequence(Value *V, Value *&Src);
175174

176175
bool RecordMemoryOps(BasicBlock *BB);
177176
void InsertParallelMACs(Reduction &Reduction);
@@ -283,7 +282,7 @@ bool ARMParallelDSP::AreSequentialLoads(LoadInst *Ld0, LoadInst *Ld1,
283282
// TODO: we currently only collect i16, and will support i8 later, so that's
284283
// why we check that types are equal to MaxBitWidth, and not <= MaxBitWidth.
285284
template<unsigned MaxBitWidth>
286-
bool ARMParallelDSP::IsNarrowSequence(Value *V, ValueList &VL) {
285+
bool ARMParallelDSP::IsNarrowSequence(Value *V, Value *&Src) {
287286
if (auto *SExt = dyn_cast<SExtInst>(V)) {
288287
if (SExt->getSrcTy()->getIntegerBitWidth() != MaxBitWidth)
289288
return false;
@@ -293,8 +292,7 @@ bool ARMParallelDSP::IsNarrowSequence(Value *V, ValueList &VL) {
293292
if (!LoadPairs.count(Ld) && !OffsetLoads.count(Ld))
294293
return false;
295294

296-
VL.push_back(Ld);
297-
VL.push_back(SExt);
295+
Src = Ld;
298296
return true;
299297
}
300298
}
@@ -461,8 +459,8 @@ bool ARMParallelDSP::MatchSMLAD(Function &F) {
461459
Value *MulOp0 = I->getOperand(0);
462460
Value *MulOp1 = I->getOperand(1);
463461
if (isa<SExtInst>(MulOp0) && isa<SExtInst>(MulOp1)) {
464-
ValueList LHS;
465-
ValueList RHS;
462+
Value *LHS = nullptr;
463+
Value *RHS = nullptr;
466464
if (IsNarrowSequence<16>(MulOp0, LHS) &&
467465
IsNarrowSequence<16>(MulOp1, RHS)) {
468466
R.InsertMul(I, LHS, RHS);

0 commit comments

Comments
 (0)