@@ -49,7 +49,6 @@ namespace {
49
49
50
50
using MulCandList = SmallVector<std::unique_ptr<MulCandidate>, 8 >;
51
51
using ReductionList = SmallVector<Reduction, 8 >;
52
- using ValueList = SmallVector<Value*, 8 >;
53
52
using MemInstList = SmallVector<LoadInst*, 8 >;
54
53
using PMACPair = std::pair<MulCandidate*,MulCandidate*>;
55
54
using PMACPairList = SmallVector<PMACPair, 8 >;
@@ -64,8 +63,8 @@ namespace {
64
63
bool Exchange = false ;
65
64
bool ReadOnly = true ;
66
65
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) { }
69
68
70
69
bool HasTwoLoadInputs () const {
71
70
return isa<LoadInst>(LHS) && isa<LoadInst>(RHS);
@@ -95,7 +94,7 @@ namespace {
95
94
96
95
// / Record a MulCandidate, rooted at a Mul instruction, that is a part of
97
96
// / this reduction.
98
- void InsertMul (Instruction *I, ValueList & LHS, ValueList & RHS) {
97
+ void InsertMul (Instruction *I, Value * LHS, Value * RHS) {
99
98
Muls.push_back (make_unique<MulCandidate>(I, LHS, RHS));
100
99
}
101
100
@@ -171,7 +170,7 @@ namespace {
171
170
std::map<LoadInst*, std::unique_ptr<WidenedLoad>> WideLoads;
172
171
173
172
template <unsigned >
174
- bool IsNarrowSequence (Value *V, ValueList &VL );
173
+ bool IsNarrowSequence (Value *V, Value *&Src );
175
174
176
175
bool RecordMemoryOps (BasicBlock *BB);
177
176
void InsertParallelMACs (Reduction &Reduction);
@@ -283,7 +282,7 @@ bool ARMParallelDSP::AreSequentialLoads(LoadInst *Ld0, LoadInst *Ld1,
283
282
// TODO: we currently only collect i16, and will support i8 later, so that's
284
283
// why we check that types are equal to MaxBitWidth, and not <= MaxBitWidth.
285
284
template <unsigned MaxBitWidth>
286
- bool ARMParallelDSP::IsNarrowSequence (Value *V, ValueList &VL ) {
285
+ bool ARMParallelDSP::IsNarrowSequence (Value *V, Value *&Src ) {
287
286
if (auto *SExt = dyn_cast<SExtInst>(V)) {
288
287
if (SExt->getSrcTy ()->getIntegerBitWidth () != MaxBitWidth)
289
288
return false ;
@@ -293,8 +292,7 @@ bool ARMParallelDSP::IsNarrowSequence(Value *V, ValueList &VL) {
293
292
if (!LoadPairs.count (Ld) && !OffsetLoads.count (Ld))
294
293
return false ;
295
294
296
- VL.push_back (Ld);
297
- VL.push_back (SExt);
295
+ Src = Ld;
298
296
return true ;
299
297
}
300
298
}
@@ -461,8 +459,8 @@ bool ARMParallelDSP::MatchSMLAD(Function &F) {
461
459
Value *MulOp0 = I->getOperand (0 );
462
460
Value *MulOp1 = I->getOperand (1 );
463
461
if (isa<SExtInst>(MulOp0) && isa<SExtInst>(MulOp1)) {
464
- ValueList LHS;
465
- ValueList RHS;
462
+ Value * LHS = nullptr ;
463
+ Value * RHS = nullptr ;
466
464
if (IsNarrowSequence<16 >(MulOp0, LHS) &&
467
465
IsNarrowSequence<16 >(MulOp1, RHS)) {
468
466
R.InsertMul (I, LHS, RHS);
0 commit comments