[llvm] 74d8628 - [ConstraintElimination] Skip compares with scalable vector types.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 2 16:57:38 PDT 2022
Author: Florian Hahn
Date: 2022-11-02T23:57:14Z
New Revision: 74d8628cf7cbf442f37fbc3a7012ed77e8749d3c
URL: https://github.com/llvm/llvm-project/commit/74d8628cf7cbf442f37fbc3a7012ed77e8749d3c
DIFF: https://github.com/llvm/llvm-project/commit/74d8628cf7cbf442f37fbc3a7012ed77e8749d3c.diff
LOG: [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.
Added:
Modified:
llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
llvm/test/Transforms/ConstraintElimination/geps-ptrvector.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
index 375aa4e2cd440..a78bfbb54144b 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<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);
diff --git a/llvm/test/Transforms/ConstraintElimination/geps-ptrvector.ll b/llvm/test/Transforms/ConstraintElimination/geps-ptrvector.ll
index df915653e08e1..0f5a28b3c5671 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 <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
+}
More information about the llvm-commits
mailing list