[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.
This commit is contained in:
Florian Hahn 2022-11-02 23:57:06 +00:00
parent 40e9947317
commit 74d8628cf7
No known key found for this signature in database
GPG Key ID: CF59919C6547A668
2 changed files with 30 additions and 0 deletions

View File

@ -754,6 +754,13 @@ static Constant *getScalarConstOrSplat(ConstantInt *C, Type *Ty) {
static bool checkAndReplaceCondition(CmpInst *Cmp, ConstraintInfo &Info) {
LLVM_DEBUG(dbgs() << "Checking " << *Cmp << "\n");
// TODO: Implement splat of boolean value for scalable vectors.
if (isa<ScalableVectorType>(Cmp->getType())) {
LLVM_DEBUG(dbgs() << " skipping due to scalable vectors\n");
return false;
}
CmpInst::Predicate Pred = Cmp->getPredicate();
Value *A = Cmp->getOperand(0);
Value *B = Cmp->getOperand(1);

View File

@ -34,3 +34,26 @@ define <2 x i1> @test.vectorgep.ult.false(<2 x ptr> %vec) {
%t.1 = icmp ult <2 x ptr> %gep.1, %vec
ret <2 x i1> %t.1
}
define <vscale x 2 x i1> @test.scalable.vectorgep.ult.true(<vscale x 2 x ptr> %vec) {
; CHECK-LABEL: @test.scalable.vectorgep.ult.true(
; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, <vscale x 2 x ptr> [[VEC:%.*]], i64 1
; CHECK-NEXT: [[T_1:%.*]] = icmp ult <vscale x 2 x ptr> [[VEC]], [[GEP_1]]
; CHECK-NEXT: ret <vscale x 2 x i1> [[T_1]]
;
%gep.1 = getelementptr inbounds i32, <vscale x 2 x ptr> %vec, i64 1
%t.1 = icmp ult <vscale x 2 x ptr> %vec, %gep.1
ret <vscale x 2 x i1> %t.1
}
define <vscale x 2 x i1> @test.scalable.vectorgep.ult.false(<vscale x 2 x ptr> %vec) {
; CHECK-LABEL: @test.scalable.vectorgep.ult.false(
; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, <vscale x 2 x ptr> [[VEC:%.*]], i64 1
; CHECK-NEXT: [[T_1:%.*]] = icmp ult <vscale x 2 x ptr> [[GEP_1]], [[VEC]]
; CHECK-NEXT: ret <vscale x 2 x i1> [[T_1]]
;
%gep.1 = getelementptr inbounds i32, <vscale x 2 x ptr> %vec, i64 1
%t.1 = icmp ult <vscale x 2 x ptr> %gep.1, %vec
ret <vscale x 2 x i1> %t.1
}