[PATCH] D144895: [SLP] Fixes crash in BoUpSLP::isGatherShuffledEntry()
Vasileios Porpodas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 27 10:56:00 PST 2023
vporpo updated this revision to Diff 500850.
vporpo added a comment.
Replace TE->Scalars with VL, as suggested.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144895/new/
https://reviews.llvm.org/D144895
Files:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/X86/crash_clear_undefs.ll
Index: llvm/test/Transforms/SLPVectorizer/X86/crash_clear_undefs.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/SLPVectorizer/X86/crash_clear_undefs.ll
@@ -0,0 +1,50 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -passes=slp-vectorizer -S -mtriple=x86_64-- -mcpu=corei7 | FileCheck %s
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+
+define i1 @foo() {
+; CHECK-LABEL: @foo(
+; CHECK-NEXT: [[TMP1:%.*]] = load float, ptr null, align 4
+; CHECK-NEXT: br i1 false, label [[TMP15:%.*]], label [[TMP2:%.*]]
+; CHECK: 2:
+; CHECK-NEXT: [[TMP3:%.*]] = extractelement <4 x float> zeroinitializer, i64 0
+; CHECK-NEXT: [[TMP4:%.*]] = insertelement <2 x float> poison, float [[TMP1]], i32 0
+; CHECK-NEXT: [[TMP5:%.*]] = insertelement <2 x float> [[TMP4]], float [[TMP3]], i32 1
+; CHECK-NEXT: [[TMP6:%.*]] = fadd <2 x float> [[TMP5]], zeroinitializer
+; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <2 x float> [[TMP6]], <2 x float> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
+; CHECK-NEXT: [[TMP8:%.*]] = insertelement <4 x float> poison, float [[TMP1]], i32 0
+; CHECK-NEXT: [[TMP9:%.*]] = insertelement <4 x float> [[TMP8]], float [[TMP3]], i32 1
+; CHECK-NEXT: [[TMP10:%.*]] = shufflevector <4 x float> [[TMP9]], <4 x float> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
+; CHECK-NEXT: [[TMP11:%.*]] = select <4 x i1> zeroinitializer, <4 x float> [[TMP7]], <4 x float> [[TMP10]]
+; CHECK-NEXT: [[TMP12:%.*]] = fsub <4 x float> [[TMP11]], zeroinitializer
+; CHECK-NEXT: [[TMP13:%.*]] = fadd <4 x float> [[TMP11]], zeroinitializer
+; CHECK-NEXT: [[TMP14:%.*]] = shufflevector <4 x float> [[TMP12]], <4 x float> [[TMP13]], <4 x i32> <i32 0, i32 1, i32 6, i32 7>
+; CHECK-NEXT: br label [[TMP15]]
+; CHECK: 15:
+; CHECK-NEXT: [[TMP16:%.*]] = phi <4 x float> [ [[TMP14]], [[TMP2]] ], [ zeroinitializer, [[TMP0:%.*]] ]
+; CHECK-NEXT: ret i1 false
+;
+ %1 = load float, ptr null, align 4
+ br i1 false, label %14, label %2
+
+2: ; preds = %0
+ %3 = extractelement <4 x float> zeroinitializer, i64 0
+ %4 = fadd float %1, 0.000000e+00
+ %5 = fadd float %3, 0.000000e+00
+ %6 = select i1 false, float %4, float %1
+ %7 = fsub float %6, 0.000000e+00
+ %8 = select i1 false, float %5, float %3
+ %9 = fsub float %8, 0.000000e+00
+ %10 = select i1 false, float %4, float %1
+ %11 = fadd float 0.000000e+00, %10
+ %12 = select i1 false, float %5, float %3
+ %13 = fadd float 0.000000e+00, %12
+ br label %14
+
+14: ; preds = %2, %0
+ %15 = phi float [ %7, %2 ], [ 0.000000e+00, %0 ]
+ %16 = phi float [ %9, %2 ], [ 0.000000e+00, %0 ]
+ %17 = phi float [ %11, %2 ], [ 0.000000e+00, %0 ]
+ %18 = phi float [ %13, %2 ], [ 0.000000e+00, %0 ]
+ ret i1 false
+}
Index: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -8469,7 +8469,7 @@
std::iota(Mask.begin(), Mask.end(), 0);
// Clear undef scalars.
for (int I = 0, Sz = VL.size(); I < Sz; ++I)
- if (isa<PoisonValue>(TE->Scalars[I]))
+ if (isa<PoisonValue>(VL[I]))
Mask[I] = UndefMaskElem;
return TargetTransformInfo::SK_PermuteSingleSrc;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144895.500850.patch
Type: text/x-patch
Size: 3537 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230227/1c874444/attachment.bin>
More information about the llvm-commits
mailing list