Skip to content

Commit

Permalink
[ConstraintElim] Drop bail out for scalable vectors after using getTrue
Browse files Browse the repository at this point in the history
ConstantInt::getTrue/getFalse can materialize scalable vectors with all
lanes true/false.
  • Loading branch information
fhahn committed Nov 3, 2022
1 parent b36d678 commit 8086b0c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 0 additions & 6 deletions llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/ConstraintElimination/geps-ptrvector.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 8086b0c

Please sign in to comment.