[llvm] 8086b0c - [ConstraintElim] Drop bail out for scalable vectors after using getTrue

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 3 12:06:10 PDT 2022


Author: Florian Hahn
Date: 2022-11-03T19:05:45Z
New Revision: 8086b0c8a883ea257519ff48d4445c8ff6a717a0

URL: https://github.com/llvm/llvm-project/commit/8086b0c8a883ea257519ff48d4445c8ff6a717a0
DIFF: https://github.com/llvm/llvm-project/commit/8086b0c8a883ea257519ff48d4445c8ff6a717a0.diff

LOG: [ConstraintElim] Drop bail out for scalable vectors after using getTrue

ConstantInt::getTrue/getFalse can materialize scalable vectors with all
lanes true/false.

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 9c304d1f955c8..bd214e004a022 100644
--- a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
@@ -749,12 +749,6 @@ void State::addInfoFor(BasicBlock &BB) {
 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 0f5a28b3c5671..93d940f2de3ba 100644
--- a/llvm/test/Transforms/ConstraintElimination/geps-ptrvector.ll
+++ b/llvm/test/Transforms/ConstraintElimination/geps-ptrvector.ll
@@ -40,7 +40,7 @@ define <vscale x 2 x i1> @test.scalable.vectorgep.ult.true(<vscale x 2 x ptr> %v
 ; 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]]
+; CHECK-NEXT:    ret <vscale x 2 x i1> shufflevector (<vscale x 2 x i1> insertelement (<vscale x 2 x i1> poison, i1 true, i32 0), <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer)
 ;
   %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
@@ -51,7 +51,7 @@ define <vscale x 2 x i1> @test.scalable.vectorgep.ult.false(<vscale x 2 x ptr> %
 ; 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]]
+; CHECK-NEXT:    ret <vscale x 2 x i1> zeroinitializer
 ;
   %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


        


More information about the llvm-commits mailing list