@@ -13,10 +13,6 @@ define void @selects_1(ptr nocapture %dst, i32 %A, i32 %B, i32 %C, i32 %N) {
13
13
; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %cond6 = select i1 %cmp2, i32 30, i32 %and
14
14
; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %cond11 = select i1 %cmp7, i32 %cond, i32 %cond6
15
15
16
- ; CHECK-LABEL: define void @selects_1(
17
- ; CHECK: vector.body:
18
- ; CHECK: select <4 x i1>
19
-
20
16
entry:
21
17
%cmp26 = icmp sgt i32 %N , 0
22
18
br i1 %cmp26 , label %for.body.preheader , label %for.cond.cleanup
@@ -47,3 +43,47 @@ for.cond.cleanup.loopexit: ; preds = %for.body
47
43
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
48
44
ret void
49
45
}
46
+
47
+ define i32 @multi_user_cmp (ptr readonly %a , i32 noundef %n ) {
48
+ ; CHECK: LV: Found an estimated cost of 0 for VF 16 For instruction: %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
49
+ ; CHECK-NEXT: LV: Found an estimated cost of 0 for VF 16 For instruction: %all.0.off010 = phi i1 [ true, %entry ], [ %all.0.off0., %for.body ]
50
+ ; CHECK-NEXT: LV: Found an estimated cost of 0 for VF 16 For instruction: %any.0.off09 = phi i1 [ false, %entry ], [ %.any.0.off0, %for.body ]
51
+ ; CHECK-NEXT: LV: Found an estimated cost of 0 for VF 16 For instruction: %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv
52
+ ; CHECK-NEXT: LV: Found an estimated cost of 4 for VF 16 For instruction: %load1 = load float, ptr %arrayidx, align 4
53
+ ; CHECK-NEXT: LV: Found an estimated cost of 4 for VF 16 For instruction: %cmp1 = fcmp olt float %load1, 0.000000e+00
54
+ ; CHECK-NEXT: LV: Found an estimated cost of 1 for VF 16 For instruction: %.any.0.off0 = select i1 %cmp1, i1 true, i1 %any.0.off09
55
+ ; CHECK-NEXT: LV: Found an estimated cost of 1 for VF 16 For instruction: %all.0.off0. = select i1 %cmp1, i1 %all.0.off010, i1 false
56
+ ; CHECK-NEXT: LV: Found an estimated cost of 1 for VF 16 For instruction: %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
57
+ ; CHECK-NEXT: LV: Found an estimated cost of 1 for VF 16 For instruction: %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
58
+ ; CHECK-NEXT: LV: Found an estimated cost of 0 for VF 16 For instruction: br i1 %exitcond.not, label %exit, label %for.body
59
+ ; CHECK-NEXT: LV: Vector loop of width 16 costs: 0.
60
+ entry:
61
+ %wide.trip.count = zext nneg i32 %n to i64
62
+ br label %for.body
63
+
64
+ for.body:
65
+ %indvars.iv = phi i64 [ 0 , %entry ], [ %indvars.iv.next , %for.body ]
66
+ %all.0.off010 = phi i1 [ true , %entry ], [ %all.0.off0. , %for.body ]
67
+ %any.0.off09 = phi i1 [ false , %entry ], [ %.any.0.off0 , %for.body ]
68
+ %arrayidx = getelementptr inbounds float , ptr %a , i64 %indvars.iv
69
+ %load1 = load float , ptr %arrayidx , align 4
70
+ %cmp1 = fcmp olt float %load1 , 0 .000000e+00
71
+ %.any.0.off0 = select i1 %cmp1 , i1 true , i1 %any.0.off09
72
+ %all.0.off0. = select i1 %cmp1 , i1 %all.0.off010 , i1 false
73
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv , 1
74
+ %exitcond.not = icmp eq i64 %indvars.iv.next , %wide.trip.count
75
+ br i1 %exitcond.not , label %exit , label %for.body
76
+
77
+ exit:
78
+ %0 = select i1 %.any.0.off0 , i32 2 , i32 3
79
+ %1 = select i1 %all.0.off0. , i32 1 , i32 %0
80
+ ret i32 %1
81
+ }
82
+
83
+ ; CHECK-LABEL: define void @selects_1(
84
+ ; CHECK: vector.body:
85
+ ; CHECK: select <4 x i1>
86
+
87
+ ; CHECK-LABEL: define i32 @multi_user_cmp(
88
+ ; CHECK: vector.body:
89
+ ; CHECK: %index = phi i64
0 commit comments