Skip to content

Commit 46f323d

Browse files
committed
[SLP][REVEC] Remove assert because canConvertToMinOrMaxIntrinsic can
support vector type.
1 parent bf94802 commit 46f323d

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10777,7 +10777,6 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
1077710777
// If the selects are the only uses of the compares, they will be
1077810778
// dead and we can adjust the cost by removing their cost.
1077910779
if (VI && SelectOnly) {
10780-
assert(!Ty->isVectorTy() && "Expected only for scalar type.");
1078110780
auto *CI = cast<CmpInst>(VI->getOperand(0));
1078210781
IntrinsicCost -= TTI->getCmpSelInstrCost(
1078310782
CI->getOpcode(), Ty, Builder.getInt1Ty(), CI->getPredicate(),

llvm/test/Transforms/SLPVectorizer/RISCV/revec.ll

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,26 @@ entry:
9696
}
9797

9898
define void @test3(float %0) {
99+
; CHECK-LABEL: @test3(
100+
; CHECK-NEXT: entry:
101+
; CHECK-NEXT: br label [[FOR_BODY_LR_PH:%.*]]
102+
; CHECK: for.body.lr.ph:
103+
; CHECK-NEXT: [[TMP1:%.*]] = call <4 x float> @llvm.vector.insert.v4f32.v2f32(<4 x float> poison, <2 x float> zeroinitializer, i64 0)
104+
; CHECK-NEXT: [[TMP2:%.*]] = call <4 x float> @llvm.vector.insert.v4f32.v2f32(<4 x float> [[TMP1]], <2 x float> zeroinitializer, i64 2)
105+
; CHECK-NEXT: br i1 false, label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY:%.*]]
106+
; CHECK: for.cond.cleanup:
107+
; CHECK-NEXT: [[TMP3:%.*]] = phi <4 x float> [ [[TMP2]], [[FOR_BODY_LR_PH]] ], [ [[TMP10:%.*]], [[FOR_BODY]] ]
108+
; CHECK-NEXT: ret void
109+
; CHECK: for.body:
110+
; CHECK-NEXT: [[TMP4:%.*]] = load <2 x float>, ptr null, align 4
111+
; CHECK-NEXT: [[TMP5:%.*]] = fcmp olt <2 x float> zeroinitializer, [[TMP4]]
112+
; CHECK-NEXT: [[TMP6:%.*]] = call <4 x i1> @llvm.vector.insert.v4i1.v2i1(<4 x i1> poison, <2 x i1> <i1 true, i1 true>, i64 0)
113+
; CHECK-NEXT: [[TMP7:%.*]] = call <4 x i1> @llvm.vector.insert.v4i1.v2i1(<4 x i1> [[TMP6]], <2 x i1> [[TMP5]], i64 2)
114+
; CHECK-NEXT: [[TMP8:%.*]] = call <4 x float> @llvm.vector.insert.v4f32.v2f32(<4 x float> poison, <2 x float> [[TMP4]], i64 0)
115+
; CHECK-NEXT: [[TMP9:%.*]] = shufflevector <4 x float> [[TMP8]], <4 x float> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
116+
; CHECK-NEXT: [[TMP10]] = select <4 x i1> [[TMP7]], <4 x float> [[TMP9]], <4 x float> [[TMP2]]
117+
; CHECK-NEXT: br label [[FOR_COND_CLEANUP]]
118+
;
99119
entry:
100120
br label %for.body.lr.ph
101121

0 commit comments

Comments
 (0)