[llvm] [SLP][REVEC] Initial commits. (PR #98269)
Han-Kuan Chen via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 10 21:16:42 PDT 2024
================
@@ -11807,10 +11824,10 @@ class BoUpSLP::ShuffleInstructionBuilder final : public BaseShuffleAnalysis {
Value *castToScalarTyElem(Value *V,
std::optional<bool> IsSigned = std::nullopt) {
auto *VecTy = cast<VectorType>(V->getType());
- if (VecTy->getElementType() == ScalarTy)
+ if (VecTy->getElementType() == ScalarTy->getScalarType())
----------------
HanKuanChen wrote:
Maybe my previous description cause misleading.
The `V` here is a vectorized result. The number of elements for `V` cannot be equal to the number of elements for `ScalarTy`.
For example,
```
%0 = load <4 x i32>, ptr %a, align 4
%1 = load <4 x i32>, ptr %arrayidx3, align 4
%2 = load <4 x i32>, ptr %arrayidx7, align 4
%3 = load <4 x i32>, ptr %arrayidx11, align 4
```
The `ScalarTy` here is `<4 x i32>` but `VecTy` is `<16 x i32>`. (from `FinalShuffle -> ShuffleBuilder.addOrdered -> add -> castToScalarTyElem`)
It also happend when REVEC is disabled. See `llvm/test/Transforms/SLPVectorizer/reschedule.ll`, `ScalarTy` is `double` but `VecTy` is `<2 x double>`.
https://github.com/llvm/llvm-project/pull/98269
More information about the llvm-commits
mailing list