Skip to content

Commit 74d8628

Browse files
committed
[ConstraintElimination] Skip compares with scalable vector types.
Materializing scalable vectors with boolean values is not implemented yet. Skip those cases for now and leave a TODO.
1 parent 40e9947 commit 74d8628

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

llvm/lib/Transforms/Scalar/ConstraintElimination.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,13 @@ static Constant *getScalarConstOrSplat(ConstantInt *C, Type *Ty) {
754754

755755
static bool checkAndReplaceCondition(CmpInst *Cmp, ConstraintInfo &Info) {
756756
LLVM_DEBUG(dbgs() << "Checking " << *Cmp << "\n");
757+
758+
// TODO: Implement splat of boolean value for scalable vectors.
759+
if (isa<ScalableVectorType>(Cmp->getType())) {
760+
LLVM_DEBUG(dbgs() << " skipping due to scalable vectors\n");
761+
return false;
762+
}
763+
757764
CmpInst::Predicate Pred = Cmp->getPredicate();
758765
Value *A = Cmp->getOperand(0);
759766
Value *B = Cmp->getOperand(1);

llvm/test/Transforms/ConstraintElimination/geps-ptrvector.ll

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,26 @@ define <2 x i1> @test.vectorgep.ult.false(<2 x ptr> %vec) {
3434
%t.1 = icmp ult <2 x ptr> %gep.1, %vec
3535
ret <2 x i1> %t.1
3636
}
37+
38+
39+
define <vscale x 2 x i1> @test.scalable.vectorgep.ult.true(<vscale x 2 x ptr> %vec) {
40+
; CHECK-LABEL: @test.scalable.vectorgep.ult.true(
41+
; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, <vscale x 2 x ptr> [[VEC:%.*]], i64 1
42+
; CHECK-NEXT: [[T_1:%.*]] = icmp ult <vscale x 2 x ptr> [[VEC]], [[GEP_1]]
43+
; CHECK-NEXT: ret <vscale x 2 x i1> [[T_1]]
44+
;
45+
%gep.1 = getelementptr inbounds i32, <vscale x 2 x ptr> %vec, i64 1
46+
%t.1 = icmp ult <vscale x 2 x ptr> %vec, %gep.1
47+
ret <vscale x 2 x i1> %t.1
48+
}
49+
50+
define <vscale x 2 x i1> @test.scalable.vectorgep.ult.false(<vscale x 2 x ptr> %vec) {
51+
; CHECK-LABEL: @test.scalable.vectorgep.ult.false(
52+
; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, <vscale x 2 x ptr> [[VEC:%.*]], i64 1
53+
; CHECK-NEXT: [[T_1:%.*]] = icmp ult <vscale x 2 x ptr> [[GEP_1]], [[VEC]]
54+
; CHECK-NEXT: ret <vscale x 2 x i1> [[T_1]]
55+
;
56+
%gep.1 = getelementptr inbounds i32, <vscale x 2 x ptr> %vec, i64 1
57+
%t.1 = icmp ult <vscale x 2 x ptr> %gep.1, %vec
58+
ret <vscale x 2 x i1> %t.1
59+
}

0 commit comments

Comments
 (0)