1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s
6 ; Make sure we do not crash when trying to inject info about vector values from SCEV.
7 define void @test_vector_iv(i32 %x, i1 %c) {
8 ; CHECK-LABEL: @test_vector_iv(
10 ; CHECK-NEXT: br i1 [[C:%.*]], label [[PRE:%.*]], label [[BB2:%.*]]
12 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X:%.*]], 10
13 ; CHECK-NEXT: br i1 [[C_1]], label [[LOOP:%.*]], label [[BB2]]
15 ; CHECK-NEXT: [[IV:%.*]] = phi <4 x i8> [ zeroinitializer, [[PRE]] ], [ [[IV_NEXT:%.*]], [[LOOP]] ]
16 ; CHECK-NEXT: call void @use(i1 true)
17 ; CHECK-NEXT: call void @use(i1 false)
18 ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[X]], 9
19 ; CHECK-NEXT: call void @use(i1 [[C_2]])
20 ; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i32 [[X]], 9
21 ; CHECK-NEXT: call void @use(i1 [[C_3]])
22 ; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw <4 x i8> [[IV]], <i8 1, i8 1, i8 1, i8 1>
23 ; CHECK-NEXT: [[E:%.*]] = extractelement <4 x i8> [[IV_NEXT]], i8 2
24 ; CHECK-NEXT: [[EC:%.*]] = icmp eq i8 [[E]], 100
25 ; CHECK-NEXT: br i1 [[EC]], label [[EXIT:%.*]], label [[LOOP]]
27 ; CHECK-NEXT: call void @use(i1 true)
28 ; CHECK-NEXT: ret void
30 ; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i32 [[X]], 10
31 ; CHECK-NEXT: call void @use(i1 [[C_5]])
32 ; CHECK-NEXT: ret void
35 br i1 %c, label %pre, label %bb2
38 %c.1 = icmp ule i32 %x, 10
39 br i1 %c.1, label %loop, label %bb2
42 %iv = phi <4 x i8> [ zeroinitializer, %pre ], [ %iv.next, %loop ]
43 %t.1 = icmp ule i32 %x, 10
44 call void @use(i1 %t.1)
45 %f.1 = icmp ugt i32 %x, 10
46 call void @use(i1 %f.1)
48 %c.2 = icmp ule i32 %x, 9
49 call void @use(i1 %c.2)
50 %c.3 = icmp ugt i32 %x, 9
51 call void @use(i1 %c.3)
53 %iv.next = add nuw nsw <4 x i8> %iv, <i8 1, i8 1, i8 1, i8 1>
54 %e = extractelement <4 x i8> %iv.next, i8 2
55 %ec = icmp eq i8 %e, 100
56 br i1 %ec, label %exit, label %loop
59 %c.4 = icmp ule i32 %x, 10
60 call void @use(i1 %c.4)
64 %c.5 = icmp ugt i32 %x, 10
65 call void @use(i1 %c.5)