Skip to content

Commit 8086b0c

Browse files
committed
[ConstraintElim] Drop bail out for scalable vectors after using getTrue
ConstantInt::getTrue/getFalse can materialize scalable vectors with all lanes true/false.
1 parent b36d678 commit 8086b0c

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

llvm/lib/Transforms/Scalar/ConstraintElimination.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -749,12 +749,6 @@ void State::addInfoFor(BasicBlock &BB) {
749749
static bool checkAndReplaceCondition(CmpInst *Cmp, ConstraintInfo &Info) {
750750
LLVM_DEBUG(dbgs() << "Checking " << *Cmp << "\n");
751751

752-
// TODO: Implement splat of boolean value for scalable vectors.
753-
if (isa<ScalableVectorType>(Cmp->getType())) {
754-
LLVM_DEBUG(dbgs() << " skipping due to scalable vectors\n");
755-
return false;
756-
}
757-
758752
CmpInst::Predicate Pred = Cmp->getPredicate();
759753
Value *A = Cmp->getOperand(0);
760754
Value *B = Cmp->getOperand(1);

llvm/test/Transforms/ConstraintElimination/geps-ptrvector.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ define <vscale x 2 x i1> @test.scalable.vectorgep.ult.true(<vscale x 2 x ptr> %v
4040
; CHECK-LABEL: @test.scalable.vectorgep.ult.true(
4141
; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, <vscale x 2 x ptr> [[VEC:%.*]], i64 1
4242
; CHECK-NEXT: [[T_1:%.*]] = icmp ult <vscale x 2 x ptr> [[VEC]], [[GEP_1]]
43-
; CHECK-NEXT: ret <vscale x 2 x i1> [[T_1]]
43+
; 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)
4444
;
4545
%gep.1 = getelementptr inbounds i32, <vscale x 2 x ptr> %vec, i64 1
4646
%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> %
5151
; CHECK-LABEL: @test.scalable.vectorgep.ult.false(
5252
; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, <vscale x 2 x ptr> [[VEC:%.*]], i64 1
5353
; CHECK-NEXT: [[T_1:%.*]] = icmp ult <vscale x 2 x ptr> [[GEP_1]], [[VEC]]
54-
; CHECK-NEXT: ret <vscale x 2 x i1> [[T_1]]
54+
; CHECK-NEXT: ret <vscale x 2 x i1> zeroinitializer
5555
;
5656
%gep.1 = getelementptr inbounds i32, <vscale x 2 x ptr> %vec, i64 1
5757
%t.1 = icmp ult <vscale x 2 x ptr> %gep.1, %vec

0 commit comments

Comments
 (0)