From: Florian Hahn Date: Wed, 2 Nov 2022 23:57:06 +0000 (+0000) Subject: [ConstraintElimination] Skip compares with scalable vector types. X-Git-Tag: upstream/17.0.6~28660 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=74d8628cf7cbf442f37fbc3a7012ed77e8749d3c;p=platform%2Fupstream%2Fllvm.git [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. --- diff --git a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp index 375aa4e..a78bfbb 100644 --- a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp +++ b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp @@ -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(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); diff --git a/llvm/test/Transforms/ConstraintElimination/geps-ptrvector.ll b/llvm/test/Transforms/ConstraintElimination/geps-ptrvector.ll index df91565..0f5a28b 100644 --- a/llvm/test/Transforms/ConstraintElimination/geps-ptrvector.ll +++ b/llvm/test/Transforms/ConstraintElimination/geps-ptrvector.ll @@ -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 @test.scalable.vectorgep.ult.true( %vec) { +; CHECK-LABEL: @test.scalable.vectorgep.ult.true( +; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, [[VEC:%.*]], i64 1 +; CHECK-NEXT: [[T_1:%.*]] = icmp ult [[VEC]], [[GEP_1]] +; CHECK-NEXT: ret [[T_1]] +; + %gep.1 = getelementptr inbounds i32, %vec, i64 1 + %t.1 = icmp ult %vec, %gep.1 + ret %t.1 +} + +define @test.scalable.vectorgep.ult.false( %vec) { +; CHECK-LABEL: @test.scalable.vectorgep.ult.false( +; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, [[VEC:%.*]], i64 1 +; CHECK-NEXT: [[T_1:%.*]] = icmp ult [[GEP_1]], [[VEC]] +; CHECK-NEXT: ret [[T_1]] +; + %gep.1 = getelementptr inbounds i32, %vec, i64 1 + %t.1 = icmp ult %gep.1, %vec + ret %t.1 +}