1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s
4 ; Should not crash when GEP pointer operand is a vector.
5 define <2 x i1> @test.vectorgep(<2 x ptr> %vec) {
6 ; CHECK-LABEL: @test.vectorgep(
7 ; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i32, <2 x ptr> [[VEC:%.*]], i64 0
8 ; CHECK-NEXT: [[COND:%.*]] = icmp ule <2 x ptr> [[GEP]], zeroinitializer
9 ; CHECK-NEXT: ret <2 x i1> [[COND]]
11 %gep = getelementptr inbounds i32, <2 x ptr> %vec, i64 0
12 %cond = icmp ule <2 x ptr> %gep, zeroinitializer
16 define <2 x i1> @test.vectorgep.ult.true(<2 x ptr> %vec) {
17 ; CHECK-LABEL: @test.vectorgep.ult.true(
18 ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, <2 x ptr> [[VEC:%.*]], i64 1
19 ; CHECK-NEXT: ret <2 x i1> <i1 true, i1 true>
21 %gep.1 = getelementptr inbounds i32, <2 x ptr> %vec, i64 1
22 %t.1 = icmp ult <2 x ptr> %vec, %gep.1
26 define <2 x i1> @test.vectorgep.ult.false(<2 x ptr> %vec) {
27 ; CHECK-LABEL: @test.vectorgep.ult.false(
28 ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, <2 x ptr> [[VEC:%.*]], i64 1
29 ; CHECK-NEXT: ret <2 x i1> zeroinitializer
31 %gep.1 = getelementptr inbounds i32, <2 x ptr> %vec, i64 1
32 %t.1 = icmp ult <2 x ptr> %gep.1, %vec
37 define <vscale x 2 x i1> @test.scalable.vectorgep.ult.true(<vscale x 2 x ptr> %vec) {
38 ; CHECK-LABEL: @test.scalable.vectorgep.ult.true(
39 ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, <vscale x 2 x ptr> [[VEC:%.*]], i64 1
40 ; CHECK-NEXT: ret <vscale x 2 x i1> shufflevector (<vscale x 2 x i1> insertelement (<vscale x 2 x i1> poison, i1 true, i64 0), <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer)
42 %gep.1 = getelementptr inbounds i32, <vscale x 2 x ptr> %vec, i64 1
43 %t.1 = icmp ult <vscale x 2 x ptr> %vec, %gep.1
44 ret <vscale x 2 x i1> %t.1
47 define <vscale x 2 x i1> @test.scalable.vectorgep.ult.false(<vscale x 2 x ptr> %vec) {
48 ; CHECK-LABEL: @test.scalable.vectorgep.ult.false(
49 ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, <vscale x 2 x ptr> [[VEC:%.*]], i64 1
50 ; CHECK-NEXT: ret <vscale x 2 x i1> zeroinitializer
52 %gep.1 = getelementptr inbounds i32, <vscale x 2 x ptr> %vec, i64 1
53 %t.1 = icmp ult <vscale x 2 x ptr> %gep.1, %vec
54 ret <vscale x 2 x i1> %t.1