[LV] Use Builder.CreateVectorReverse directly. (NFC)

IRBuilder::CreateVectorReverse already handles all cases required by
LoopVectorize. It can be used directly instead of reverseVector.
This commit is contained in:
Florian Hahn 2022-01-02 19:09:30 +00:00
parent d677a7cb05
commit 6e0a333f71
No known key found for this signature in database
GPG Key ID: EEF712BB5E80EBBA
1 changed files with 2 additions and 13 deletions

View File

@ -633,9 +633,6 @@ protected:
/// Returns true if we should generate a scalar version of \p IV.
bool needsScalarInduction(Instruction *IV) const;
/// Generate a shuffle sequence that will reverse the vector Vec.
virtual Value *reverseVector(Value *Vec);
/// Returns (and creates if needed) the original loop trip count.
Value *getOrCreateTripCount(Loop *NewLoop);
@ -849,7 +846,6 @@ public:
private:
Value *getBroadcastInstrs(Value *V) override;
Value *reverseVector(Value *Vec) override;
};
/// Encapsulate information regarding vectorization of a loop and its epilogue.
@ -2701,11 +2697,6 @@ void InnerLoopVectorizer::packScalarIntoVectorValue(VPValue *Def,
State.set(Def, VectorValue, Instance.Part);
}
Value *InnerLoopVectorizer::reverseVector(Value *Vec) {
assert(Vec->getType()->isVectorTy() && "Invalid type");
return Builder.CreateVectorReverse(Vec, "reverse");
}
// Return whether we allow using masked interleave-groups (for dealing with
// strided loads/stores that reside in predicated blocks, or for dealing
// with gaps).
@ -2868,7 +2859,7 @@ void InnerLoopVectorizer::vectorizeInterleaveGroup(
}
if (Group->isReverse())
StridedVec = reverseVector(StridedVec);
StridedVec = Builder.CreateVectorReverse(StridedVec, "reverse");
State.set(VPDefs[J], StridedVec, Part);
}
@ -2904,7 +2895,7 @@ void InnerLoopVectorizer::vectorizeInterleaveGroup(
Value *StoredVec = State.get(StoredValues[i], Part);
if (Group->isReverse())
StoredVec = reverseVector(StoredVec);
StoredVec = Builder.CreateVectorReverse(StoredVec, "reverse");
// If this member has different type, cast it to a unified type.
@ -8042,8 +8033,6 @@ void LoopVectorizationPlanner::collectTriviallyDeadInstructions(
}
}
Value *InnerLoopUnroller::reverseVector(Value *Vec) { return Vec; }
Value *InnerLoopUnroller::getBroadcastInstrs(Value *V) { return V; }
static void AddRuntimeUnrollDisableMetaData(Loop *L) {