[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
Wed Jan 3 14:15:07 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:

Thank you, Alexey.
Still not there...
Here is another variation:
```
define void @test3() {
entry:
  br label %bb3

bb1:
  %ph = phi float [ poison, %bb2 ], [ %i5, %loop ]
  unreachable

bb2:
  br i1 poison, label %bb3, label %bb1

bb3:
  br label %loop

loop:
  %ph0 = phi float [ 0.000000e+00, %bb3 ], [ %i4, %loop ]
  %ph1 = phi float [ 0.000000e+00, %bb3 ], [ %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
  %i3 = select i1 false, float %i1, float 0.000000e+00
  %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 i1 poison, label %bb1, label %loop
}
```

https://github.com/llvm/llvm-project/pull/72295


More information about the llvm-commits mailing list