4
4
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
5
5
target triple = "x86_64-unknown-linux-gnu"
6
6
7
- ; FIXME: !llvm.access.group should be preserved, loop should be vectorized.
8
7
; End-to-end test for https://github.com/llvm/llvm-project/issues/115595.
9
8
define void @test (i32 noundef %nface , i32 noundef %ncell , ptr noalias noundef %face_cell , ptr noalias noundef %x , ptr noalias noundef %y ) #0 {
10
9
; CHECK-LABEL: define void @test(
@@ -15,16 +14,16 @@ define void @test(i32 noundef %nface, i32 noundef %ncell, ptr noalias noundef %f
15
14
; CHECK: [[FOR_BODY_PREHEADER]]:
16
15
; CHECK-NEXT: [[TMP0:%.*]] = zext nneg i32 [[NFACE]] to i64
17
16
; CHECK-NEXT: [[INVARIANT_GEP:%.*]] = getelementptr inbounds nuw i32, ptr [[FACE_CELL]], i64 [[TMP0]]
18
- ; CHECK-NEXT: [[TMP1 :%.*]] = icmp ult i32 [[NFACE]], 4
19
- ; CHECK-NEXT: br i1 [[TMP1 ]], label %[[FOR_BODY_PREHEADER14:.*]], label %[[VECTOR_PH:.*]]
17
+ ; CHECK-NEXT: [[MIN_ITERS_CHECK :%.*]] = icmp ult i32 [[NFACE]], 4
18
+ ; CHECK-NEXT: br i1 [[MIN_ITERS_CHECK ]], label %[[FOR_BODY_PREHEADER14:.*]], label %[[VECTOR_PH:.*]]
20
19
; CHECK: [[VECTOR_PH]]:
21
- ; CHECK-NEXT: [[UNROLL_ITER :%.*]] = and i64 [[TMP0]], 2147483644
20
+ ; CHECK-NEXT: [[N_VEC :%.*]] = and i64 [[TMP0]], 2147483644
22
21
; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]
23
22
; CHECK: [[VECTOR_BODY]]:
24
- ; CHECK-NEXT: [[INDVARS_IV_EPIL :%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
25
- ; CHECK-NEXT: [[TMP10 :%.*]] = getelementptr inbounds nuw i32, ptr [[FACE_CELL]], i64 [[INDVARS_IV_EPIL ]]
26
- ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[TMP10 ]], align 4, !tbaa [[TBAA0:![0-9]+]], !llvm.access.group [[ACC_GRP4:![0-9]+]]
27
- ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw i32, ptr [[INVARIANT_GEP]], i64 [[INDVARS_IV_EPIL ]]
23
+ ; CHECK-NEXT: [[INDEX :%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
24
+ ; CHECK-NEXT: [[TMP1 :%.*]] = getelementptr inbounds nuw i32, ptr [[FACE_CELL]], i64 [[INDEX ]]
25
+ ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[TMP1 ]], align 4, !tbaa [[TBAA0:![0-9]+]], !llvm.access.group [[ACC_GRP4:![0-9]+]]
26
+ ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw i32, ptr [[INVARIANT_GEP]], i64 [[INDEX ]]
28
27
; CHECK-NEXT: [[WIDE_LOAD12:%.*]] = load <4 x i32>, ptr [[TMP2]], align 4, !tbaa [[TBAA0]], !llvm.access.group [[ACC_GRP4]]
29
28
; CHECK-NEXT: [[TMP3:%.*]] = sext <4 x i32> [[WIDE_LOAD]] to <4 x i64>
30
29
; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds double, ptr [[Y]], <4 x i64> [[TMP3]]
@@ -35,14 +34,14 @@ define void @test(i32 noundef %nface, i32 noundef %ncell, ptr noalias noundef %f
35
34
; CHECK-NEXT: [[TMP7:%.*]] = fcmp fast olt <4 x double> [[WIDE_MASKED_GATHER]], [[WIDE_MASKED_GATHER13]]
36
35
; CHECK-NEXT: [[TMP8:%.*]] = select <4 x i1> [[TMP7]], <4 x double> [[WIDE_MASKED_GATHER13]], <4 x double> [[WIDE_MASKED_GATHER]]
37
36
; CHECK-NEXT: tail call void @llvm.masked.scatter.v4f64.v4p0(<4 x double> [[TMP8]], <4 x ptr> [[TMP4]], i32 8, <4 x i1> splat (i1 true)), !tbaa [[TBAA5]], !llvm.access.group [[ACC_GRP4]]
38
- ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDVARS_IV_EPIL ]], 4
39
- ; CHECK-NEXT: [[TMP9:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[UNROLL_ITER ]]
37
+ ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX ]], 4
38
+ ; CHECK-NEXT: [[TMP9:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC ]]
40
39
; CHECK-NEXT: br i1 [[TMP9]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP7:![0-9]+]]
41
40
; CHECK: [[MIDDLE_BLOCK]]:
42
- ; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 [[UNROLL_ITER ]], [[TMP0]]
41
+ ; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 [[N_VEC ]], [[TMP0]]
43
42
; CHECK-NEXT: br i1 [[CMP_N]], label %[[FOR_COND_CLEANUP]], label %[[FOR_BODY_PREHEADER14]]
44
43
; CHECK: [[FOR_BODY_PREHEADER14]]:
45
- ; CHECK-NEXT: [[INDVARS_IV_PH:%.*]] = phi i64 [ 0, %[[FOR_BODY_PREHEADER]] ], [ [[UNROLL_ITER ]], %[[MIDDLE_BLOCK]] ]
44
+ ; CHECK-NEXT: [[INDVARS_IV_PH:%.*]] = phi i64 [ 0, %[[FOR_BODY_PREHEADER]] ], [ [[N_VEC ]], %[[MIDDLE_BLOCK]] ]
46
45
; CHECK-NEXT: br label %[[FOR_BODY:.*]]
47
46
; CHECK: [[FOR_COND_CLEANUP]]:
48
47
; CHECK-NEXT: ret void
0 commit comments