-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[SLP] NFC. ShuffleInstructionBuilder::add V1->getType() is always a FixedVectorType. #99842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-llvm-transforms Author: Han-Kuan Chen (HanKuanChen) ChangesFixedVectorType. castToScalarTyElem has a cast<VectorType>(V->getType()). Full diff: https://github.com/llvm/llvm-project/pull/99842.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index d8c3bae06e932..4fd819a527a3c 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -12073,11 +12073,6 @@ class BoUpSLP::ShuffleInstructionBuilder final : public BaseShuffleAnalysis {
void add(Value *V1, ArrayRef<int> Mask, bool = false) {
V1 = castToScalarTyElem(V1);
if (InVectors.empty()) {
- if (!isa<FixedVectorType>(V1->getType())) {
- V1 = createShuffle(V1, nullptr, CommonMask);
- CommonMask.assign(Mask.size(), PoisonMaskElem);
- transformMaskAfterShuffle(CommonMask, Mask);
- }
InVectors.push_back(V1);
CommonMask.assign(Mask.begin(), Mask.end());
return;
@@ -12085,8 +12080,7 @@ class BoUpSLP::ShuffleInstructionBuilder final : public BaseShuffleAnalysis {
const auto *It = find(InVectors, V1);
if (It == InVectors.end()) {
if (InVectors.size() == 2 ||
- InVectors.front()->getType() != V1->getType() ||
- !isa<FixedVectorType>(V1->getType())) {
+ InVectors.front()->getType() != V1->getType()) {
Value *V = InVectors.front();
if (InVectors.size() == 2) {
V = createShuffle(InVectors.front(), InVectors.back(), CommonMask);
@@ -12120,9 +12114,7 @@ class BoUpSLP::ShuffleInstructionBuilder final : public BaseShuffleAnalysis {
break;
}
}
- int VF = CommonMask.size();
- if (auto *FTy = dyn_cast<FixedVectorType>(V1->getType()))
- VF = FTy->getNumElements();
+ int VF = cast<FixedVectorType>(V1->getType())->getNumElements();
for (unsigned Idx = 0, Sz = CommonMask.size(); Idx < Sz; ++Idx)
if (Mask[Idx] != PoisonMaskElem && CommonMask[Idx] == PoisonMaskElem)
CommonMask[Idx] = Mask[Idx] + (It == InVectors.begin() ? 0 : VF);
|
FixedVectorType. castToScalarTyElem has a cast<VectorType>(V->getType()).
alexey-bataev
approved these changes
Jul 23, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG
yuxuanchen1997
pushed a commit
that referenced
this pull request
Jul 25, 2024
…ixedVectorType. (#99842) Summary: castToScalarTyElem has a cast<VectorType>(V->getType()). Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60251088
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
castToScalarTyElem has a cast(V->getType()).