diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-07-01 20:22:46 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-07-01 20:22:46 +0000 |
commit | 3dafb553d9e6193fa050fef20798bc32734f43ec (patch) | |
tree | 53886396ed0060c721f3ef545425c283b59b9238 /llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | |
parent | ef9c97c343cd573e349544bbf248bc8822348d59 (diff) | |
download | bcm5719-llvm-3dafb553d9e6193fa050fef20798bc32734f43ec.tar.gz bcm5719-llvm-3dafb553d9e6193fa050fef20798bc32734f43ec.zip |
[SLPVectorizer] Call InstructionsState.isOpcodeOrAlt with Instruction instead of an opcode. NFCI.
llvm-svn: 336069
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index c5088eb4800..1bca876bbbd 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -313,7 +313,8 @@ struct InstructionsState { /// Some of the instructions in the list have alternate opcodes. bool isAltShuffle() const { return Opcode != AltOpcode; } - bool isOpcodeOrAlt(unsigned CheckedOpcode) const { + bool isOpcodeOrAlt(Instruction *I) const { + unsigned CheckedOpcode = I->getOpcode(); return Opcode == CheckedOpcode || AltOpcode == CheckedOpcode; } @@ -329,7 +330,7 @@ struct InstructionsState { /// OpValue. static Value *isOneOf(const InstructionsState &S, Value *Op) { auto *I = dyn_cast<Instruction>(Op); - if (I && S.isOpcodeOrAlt(I->getOpcode())) + if (I && S.isOpcodeOrAlt(I)) return Op; return S.OpValue; } @@ -2628,8 +2629,7 @@ void BoUpSLP::reorderAltShuffleOperands(const InstructionsState &S, // Push left and right operands of binary operation into Left and Right for (Value *V : VL) { auto *I = cast<Instruction>(V); - assert(S.isOpcodeOrAlt(I->getOpcode()) && - "Incorrect instruction in vector"); + assert(S.isOpcodeOrAlt(I) && "Incorrect instruction in vector"); Left.push_back(I->getOperand(0)); Right.push_back(I->getOperand(1)); } @@ -2837,8 +2837,8 @@ void BoUpSLP::setInsertPointAfterBundle(ArrayRef<Value *> VL, auto *Front = cast<Instruction>(S.OpValue); auto *BB = Front->getParent(); assert(llvm::all_of(make_range(VL.begin(), VL.end()), [=](Value *V) -> bool { - return !S.isOpcodeOrAlt(cast<Instruction>(V)->getOpcode()) || - cast<Instruction>(V)->getParent() == BB; + auto *I = cast<Instruction>(V); + return !S.isOpcodeOrAlt(I) || I->getParent() == BB; })); // The last instruction in the bundle in program order. @@ -2878,7 +2878,7 @@ void BoUpSLP::setInsertPointAfterBundle(ArrayRef<Value *> VL, if (!LastInst) { SmallPtrSet<Value *, 16> Bundle(VL.begin(), VL.end()); for (auto &I : make_range(BasicBlock::iterator(Front), BB->end())) { - if (Bundle.erase(&I) && S.isOpcodeOrAlt(I.getOpcode())) + if (Bundle.erase(&I) && S.isOpcodeOrAlt(&I)) LastInst = &I; if (Bundle.empty()) break; @@ -3490,10 +3490,8 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) { SmallVector<Constant *, 8> Mask(e); for (unsigned i = 0; i < e; ++i) { auto *OpInst = cast<Instruction>(E->Scalars[i]); - unsigned InstOpcode = OpInst->getOpcode(); - assert(S.isOpcodeOrAlt(InstOpcode) && - "Unexpected main/alternate opcode"); - if (InstOpcode == S.AltOpcode) { + assert(S.isOpcodeOrAlt(OpInst) && "Unexpected main/alternate opcode"); + if (OpInst->getOpcode() == S.AltOpcode) { Mask[i] = Builder.getInt32(e + i); AltScalars.push_back(E->Scalars[i]); } else { |