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: [[T_1:%.*]] = icmp ule i32 [[X]], 10
17 ; CHECK-NEXT: call void @use(i1 true)
18 ; CHECK-NEXT: [[F_1:%.*]] = icmp ugt i32 [[X]], 10
19 ; CHECK-NEXT: call void @use(i1 false)
20 ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[X]], 9
21 ; CHECK-NEXT: call void @use(i1 [[C_2]])
22 ; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i32 [[X]], 9
23 ; CHECK-NEXT: call void @use(i1 [[C_3]])
24 ; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw <4 x i8> [[IV]], <i8 1, i8 1, i8 1, i8 1>
25 ; CHECK-NEXT: [[E:%.*]] = extractelement <4 x i8> [[IV_NEXT]], i8 2
26 ; CHECK-NEXT: [[EC:%.*]] = icmp eq i8 [[E]], 100
27 ; CHECK-NEXT: br i1 [[EC]], label [[EXIT:%.*]], label [[LOOP]]
29 ; CHECK-NEXT: [[C_4:%.*]] = icmp ule i32 [[X]], 10
30 ; CHECK-NEXT: call void @use(i1 true)
31 ; CHECK-NEXT: ret void
33 ; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i32 [[X]], 10
34 ; CHECK-NEXT: call void @use(i1 [[C_5]])
35 ; CHECK-NEXT: ret void
38 br i1 %c, label %pre, label %bb2
41 %c.1 = icmp ule i32 %x, 10
42 br i1 %c.1, label %loop, label %bb2
45 %iv = phi <4 x i8> [ zeroinitializer, %pre ], [ %iv.next, %loop ]
46 %t.1 = icmp ule i32 %x, 10
47 call void @use(i1 %t.1)
48 %f.1 = icmp ugt i32 %x, 10
49 call void @use(i1 %f.1)
51 %c.2 = icmp ule i32 %x, 9
52 call void @use(i1 %c.2)
53 %c.3 = icmp ugt i32 %x, 9
54 call void @use(i1 %c.3)
56 %iv.next = add nuw nsw <4 x i8> %iv, <i8 1, i8 1, i8 1, i8 1>
57 %e = extractelement <4 x i8> %iv.next, i8 2
58 %ec = icmp eq i8 %e, 100
59 br i1 %ec, label %exit, label %loop
62 %c.4 = icmp ule i32 %x, 10
63 call void @use(i1 %c.4)
67 %c.5 = icmp ugt i32 %x, 10
68 call void @use(i1 %c.5)