From 14c6dfdfe2da38653797c7070d882e7546f1c067 Mon Sep 17 00:00:00 2001 From: Sam Parker Date: Fri, 2 Aug 2019 07:32:28 +0000 Subject: [PATCH] [NFC][ARM][ParallelDSP] Remove ValueList We only care about the first element in the list. llvm-svn: 367660 --- llvm/lib/Target/ARM/ARMParallelDSP.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/llvm/lib/Target/ARM/ARMParallelDSP.cpp b/llvm/lib/Target/ARM/ARMParallelDSP.cpp index 5e7627f..1a1e2db 100644 --- a/llvm/lib/Target/ARM/ARMParallelDSP.cpp +++ b/llvm/lib/Target/ARM/ARMParallelDSP.cpp @@ -49,7 +49,6 @@ namespace { using MulCandList = SmallVector, 8>; using ReductionList = SmallVector; - using ValueList = SmallVector; using MemInstList = SmallVector; using PMACPair = std::pair; using PMACPairList = SmallVector; @@ -64,8 +63,8 @@ namespace { bool Exchange = false; bool ReadOnly = true; - MulCandidate(Instruction *I, ValueList &lhs, ValueList &rhs) : - Root(I), LHS(lhs.front()), RHS(rhs.front()) { } + MulCandidate(Instruction *I, Value *lhs, Value *rhs) : + Root(I), LHS(lhs), RHS(rhs) { } bool HasTwoLoadInputs() const { return isa(LHS) && isa(RHS); @@ -95,7 +94,7 @@ namespace { /// Record a MulCandidate, rooted at a Mul instruction, that is a part of /// this reduction. - void InsertMul(Instruction *I, ValueList &LHS, ValueList &RHS) { + void InsertMul(Instruction *I, Value *LHS, Value *RHS) { Muls.push_back(make_unique(I, LHS, RHS)); } @@ -171,7 +170,7 @@ namespace { std::map> WideLoads; template - bool IsNarrowSequence(Value *V, ValueList &VL); + bool IsNarrowSequence(Value *V, Value *&Src); bool RecordMemoryOps(BasicBlock *BB); void InsertParallelMACs(Reduction &Reduction); @@ -283,7 +282,7 @@ bool ARMParallelDSP::AreSequentialLoads(LoadInst *Ld0, LoadInst *Ld1, // TODO: we currently only collect i16, and will support i8 later, so that's // why we check that types are equal to MaxBitWidth, and not <= MaxBitWidth. template -bool ARMParallelDSP::IsNarrowSequence(Value *V, ValueList &VL) { +bool ARMParallelDSP::IsNarrowSequence(Value *V, Value *&Src) { if (auto *SExt = dyn_cast(V)) { if (SExt->getSrcTy()->getIntegerBitWidth() != MaxBitWidth) return false; @@ -293,8 +292,7 @@ bool ARMParallelDSP::IsNarrowSequence(Value *V, ValueList &VL) { if (!LoadPairs.count(Ld) && !OffsetLoads.count(Ld)) return false; - VL.push_back(Ld); - VL.push_back(SExt); + Src = Ld; return true; } } @@ -461,8 +459,8 @@ bool ARMParallelDSP::MatchSMLAD(Function &F) { Value *MulOp0 = I->getOperand(0); Value *MulOp1 = I->getOperand(1); if (isa(MulOp0) && isa(MulOp1)) { - ValueList LHS; - ValueList RHS; + Value *LHS = nullptr; + Value *RHS = nullptr; if (IsNarrowSequence<16>(MulOp0, LHS) && IsNarrowSequence<16>(MulOp1, RHS)) { R.InsertMul(I, LHS, RHS); -- 2.7.4