[llvm] [SLP][REVEC] Fix false assumption of the source for castToScalarTyElem. (PR #99424)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 17 20:45:58 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Han-Kuan Chen (HanKuanChen)
<details>
<summary>Changes</summary>
The argument V may come from adjustExtracts, which is the vector operand of ExtractElementInst. In addition, it is not existed in getTreeEntry.
The vector operand of ExtractElementInst may have a type of <1 x Ty>, ensuring that the number of elements in ScalarTy and VecTy are equal.
reference: https://github.com/llvm/llvm-project/issues/99411
---
Full diff: https://github.com/llvm/llvm-project/pull/99424.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp (+1-1)
``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index ccb6734d5618c..a09bb00f3419e 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -11850,7 +11850,7 @@ class BoUpSLP::ShuffleInstructionBuilder final : public BaseShuffleAnalysis {
Value *castToScalarTyElem(Value *V,
std::optional<bool> IsSigned = std::nullopt) {
auto *VecTy = cast<VectorType>(V->getType());
- assert(getNumElements(ScalarTy) < getNumElements(VecTy) &&
+ assert(getNumElements(ScalarTy) <= getNumElements(VecTy) &&
(getNumElements(VecTy) % getNumElements(ScalarTy) == 0));
if (VecTy->getElementType() == ScalarTy->getScalarType())
return V;
``````````
</details>
https://github.com/llvm/llvm-project/pull/99424
More information about the llvm-commits
mailing list