[llvm] [SLP] Fix crash on trying to reshuffle a scalar that was vectorized. (PR #72295)
Valery Dmitriev via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 2 20:35:55 PST 2024
================
@@ -9164,7 +9164,8 @@ BoUpSLP::tryToGatherSingleRegisterExtractElements(
continue;
}
auto *VecTy = dyn_cast<FixedVectorType>(EI->getVectorOperandType());
- if (!VecTy || !isa<ConstantInt, UndefValue>(EI->getIndexOperand()))
+ if (!VecTy || !isa<ConstantInt, UndefValue>(EI->getIndexOperand()) ||
----------------
valerydmit wrote:
The problem turned out more tricky.
Slight test modification will manifest it again:
```
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/gather_extract_from_vectorbuild.ll b/llvm/test/Transforms/SLPVectorizer/X86/gather_extract_from_vectorbuild.ll
index 3bccfac8566d..4fc682488d34 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/gather_extract_from_vectorbuild.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/gather_extract_from_vectorbuild.ll
@@ -21,7 +21,7 @@ entry:
loop:
%ph0 = phi float [ 0.000000e+00, %entry ], [ %i4, %loop ]
- %ph1 = phi float [ 0.000000e+00, %entry ], [ 0.000000e+00, %loop ]
+ %ph1 = phi float [ 0.000000e+00, %entry ], [ %i5, %loop ]
%i = fadd float 0.000000e+00, %ph0
%i1 = fadd float 0.000000e+00, %ph1
%i2 = select i1 false, float %i, float 0.000000e+00
@@ -29,5 +29,6 @@ loop:
%ins0 = insertelement <2 x float> zeroinitializer, float %i2, i64 0
%ins1 = insertelement <2 x float> %ins0, float %i3, i64 1
%i4 = extractelement <2 x float> %ins1, i64 0
+ %i5 = extractelement <2 x float> %ins1, i64 1
br label %loop
}
```
https://github.com/llvm/llvm-project/pull/72295
More information about the llvm-commits
mailing list